5

Possible Duplicate:
android lock password combinations

Respected sir, I came across a question which asked for finding all the unique pattern possible given a 3x3 matrix with numbers from 1-9. which is same as android lock screen. Can you help me how to find it ?? I was thinking can we use floyd warshall for this and increment count whenever the value changes in the subsequent matrix??

Community
  • 1
  • 1
user1502308
  • 87
  • 1
  • 2
  • 9
  • 1
    You would probably get better results by clarifying the constraints rather than limiting your audience to people who know how android lock screen works. – Kevin Stricker Aug 26 '12 at 05:44
  • Are you looking just for the number of possible combinations? – gobernador Aug 26 '12 at 05:45
  • yes i have to find all unique possible combinations that we can make using the numbers from 1-9. – user1502308 Aug 26 '12 at 06:01
  • basically we are given numbers 1-9 as their on the lock screen of android phones and we need to find all possible unique combinations that we can form of length 1-9. – user1502308 Aug 26 '12 at 06:03
  • Here's the full list (TXT file): https://github.com/delight-im/AndroidPatternLock – caw Apr 06 '14 at 22:14

1 Answers1

12

Combinations of the Android pattern lock screen would not be from 1-9. Instead, they would be 4-9, as the lock pattern needs a minimum of four inputs, and anything below that is invalid (at least 2.3 onwards. I believe 2.2 and below allowed 3 point locks). Here's the breakdown of the combinations:

Moves = 4, combinations = 1624
Moves = 5, combinations = 7152
Moves = 6, combinations = 26016
Moves = 7, combinations = 72912
Moves = 8, combinations = 140704
Moves = 9, combinations = 140704

Total possibilities: 1624 + 7152 + 26016 + 72912 + 140704 + 140704 = 389112

A complete breakdown of the Math behind this given by a Google Engineer can be found here.

Raghav Sood
  • 81,899
  • 22
  • 187
  • 195
  • But Can you tell me if I use floyd warshall and I declare a variable count to 0. And after matrix(4) which represents paths of length 4.I keep on incrementing the count whenever the value in matrix change. Will that give me the correct answer? – user1502308 Aug 26 '12 at 06:54
  • I don't know. It might work. If you do try it, please post the results here – Raghav Sood Aug 26 '12 at 07:21
  • Here is a medium article exposing the solution using python https://medium.com/@kabab/number-of-possibilities-in-android-code-pattern-295bc6841bf4 – Bachiri Taoufiq Abderrahman Jul 11 '17 at 14:15