247. Strobogrammatic Number II

A strobogrammatic number is a number that looks the same when rotated 180 degrees (upside down). The digit pairs that are valid when rotated are:

  • 0 → 0
  • 1 → 1
  • 6 → 9
  • 8 → 8
  • 9 → 6

Given an integer n, find all strobogrammatic numbers of length n. Return them as a list of strings. The order of the returned strings may be any valid order; the examples below use ascending order.

Examples
Input: 1
Output: ["0","1","8"]
Hints
Related Problems

247. Strobogrammatic Number II

A strobogrammatic number is a number that looks the same when rotated 180 degrees (upside down). The digit pairs that are valid when rotated are: