Tap here to switch tabs
Problem
Submissions

Problem: Android Unlock Patterns

Try to solve the Android Unlock Patterns problem.

Statement

Android devices have an unlock pattern screen represented by a 3imes3 imes 33 grid of buttons numbered from 11 through 99.

Given two integers m and n, return the total number of unique and valid unlock patterns with a length between m and n inclusive.

A valid unlock pattern satisfies the following rules:

  • Each pattern consists of a sequence of distinct buttons.

  • The length of the sequence must be at least m and at most n.

  • Moving between two consecutive buttons is valid if the direct line segment between them does not pass through any other button, or if every intermediate button lying directly on that line segment has already appeared earlier in the sequence.

Constraints:

  • 1≤1 \leq m, n ≤9\leq 9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Android Unlock Patterns

Try to solve the Android Unlock Patterns problem.

Statement

Android devices have an unlock pattern screen represented by a 3imes3 imes 33 grid of buttons numbered from 11 through 99.

Given two integers m and n, return the total number of unique and valid unlock patterns with a length between m and n inclusive.

A valid unlock pattern satisfies the following rules:

  • Each pattern consists of a sequence of distinct buttons.

  • The length of the sequence must be at least m and at most n.

  • Moving between two consecutive buttons is valid if the direct line segment between them does not pass through any other button, or if every intermediate button lying directly on that line segment has already appeared earlier in the sequence.

Constraints:

  • 1≤1 \leq m, n ≤9\leq 9