Android Unlock Patterns


  • 0

    Click here to see the full article post


  • 0
    S

    indexes are at both end of the diagonals for example 0,0, and 8,8
    adjacent cells on diagonal - for example 0,0 and 1,0 or 2,0 and //1,1
    What do the examples mean ?? I don't get it.


  • 0
    N

    the 8,8 in the comment is so confusing, please change it to (2,2)


  • 1
    M

    I think the time cost of calcPatterns() is O(n!), and the time cost for the whole problem is O(n*n!).


  • 0
    L

    we don't need to loop through m to n and compose sequence for each pattern length. Instead we can compose just one time for pattern length n, and when the sequence length grows between m and n, we count it to sum.


  • 0
    Z

    // indexes are at both end of the diagonals for example 0,0, and 8,8
    int mid = (index + last)/2;
    if (mid == 4)

    isn't it 5 instead of 4?


  • 0
    I
       // knight moves or adjacent cells (in a row or in a column)        
       if ((index + last) % 2 == 1)
           return true;
    

    I believe "knight moves" is not allowed without already using "5" (used[4] == true).


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.