Medium · Backtracking

Strobogrammatic Number II

Given an integer n ≥ 1, return every strobogrammatic number of length n (it reads the same after a 180° turn), as strings in any order. A number may start with 0 only when n = 1.

Examples

Example 1

n = 2

Output: 4 numbers

Example 2

n = 3

Output: 12 numbers

Rebuild it in the studio

Open every published interview problem, solution, scene, and memory room free, with no account.

More Backtracking problems