Closed sagivf closed 5 years ago
I believe that when you setSail there is no need to go over land that has already been sailed and mapped. Am I correct?
setSail
let lat = 0 let lon = 0 const setStail = () => { for (; lat < ocean.length; lat++) { for (; lon < ocean[lat].length; lon++) { if (ocean[lat][lon] === 1) { return {lat, lon} } } lon = 0; } return false } ``
I think it might save on some things but I don't think it effects the overall time complexity. Either way - nice tweak :).
I believe your correct, just wanted to see I wasn't missing anything, thanks :)
I believe that when you
setSail
there is no need to go over land that has already been sailed and mapped. Am I correct?