Skip to content

Commit

Permalink
day 239: number of dots in the loop
Browse files Browse the repository at this point in the history
  • Loading branch information
vaskoz committed Apr 22, 2019
1 parent ca148ba commit f6f89a9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions day239/problem.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ func ValidUnlockKeypadNumber() int {
jumps[3][7], jumps[7][3], jumps[4][6], jumps[6][4] = 5, 5, 5, 5, 5, 5, 5, 5
var visited [10]bool
ways := 0
for i := 4; i < 10; i++ {
ways += 4 * validUnlockKeypadNumber(visited, jumps, 1, i-1)
ways += 4 * validUnlockKeypadNumber(visited, jumps, 2, i-1)
ways += validUnlockKeypadNumber(visited, jumps, 5, i-1)
for numDots := 4; numDots < 10; numDots++ {
ways += 4 * validUnlockKeypadNumber(visited, jumps, 1, numDots-1)
ways += 4 * validUnlockKeypadNumber(visited, jumps, 2, numDots-1)
ways += validUnlockKeypadNumber(visited, jumps, 5, numDots-1)
}
return ways
}
Expand Down

0 comments on commit f6f89a9

Please sign in to comment.