I thought 1-8 touches 4 and 5, and they should be tested. However my code with such a check fails. Then I removed this test, and my code passed.
Could you be more specific? I do the similar check as well, and my code fails. So, moves such as 1-8, 2-9, 3-4, 7-2 do NOT touch the two keys in the way?!
Yep, and I only figured this out by experimenting on test cases. That's why I complained.
@ruixia Right. it should definitely be explained - it is really counter intuitive. I was going crazy by trying to understand what was wrong with my code.
@liangyue268 Same here!
If try on ur android phone, 1-8 won't actually touch 4 and 5 because each number is represented by dot .... not the square as illustrated ....
so I guess the illustration should be corrected
You can't safely make the assumption 1-8 doesn't go across 4 and 5 (especially based on some particular UI design of one of 100000 cells), just like I couldn't make the assumption 1-8 does. The description should clearly describe it.
If it is the interview, this is ABSOLUTELY a clarification question you MUST ask before start coding.
Since I don't have an Android device to test what the unlock screen looks like, I get into the same trouble....I thought 1-8 is invalid but actually it is not.......went crazy.
The problem is straightforward DFS question but the description and example is very misleading. The last example says jump from 9-2 is valid but why? It pass through two cells - 5 and 6.
Can not agree more.
It's quite an ordeal for me to add codes for testing touches like"2-9", but always get wrong answer.
I feel like being played as fool after saw the posted correct answers.
I agree with this. Wasted some time thinking about how to take care of those cases too!
@1337c0d3r Could you update the description, or add an example indicating move
1->8 is valid?
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.