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

Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.

More Backtracking problems