Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

patterns possible on 3x3 matrix of numbers [duplicate]

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??

like image 432
user1502308 Avatar asked Aug 26 '12 05:08

user1502308


1 Answers

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.

like image 198
Raghav Sood Avatar answered Sep 29 '22 21:09

Raghav Sood