Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

So how would the expected answer look like?

1. Create an array of visited squares

2. Return false if square has been visited before, add current square to visited

3. Return true

Would this be correct?



Sort of. Store the squares in a hash map with the value used to indicate whether you've already seen it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: