For the given length n, find all n-length Strobogrammatic numbers.
Strobogrammatic Number is a number whose numeral is rotationally symmetric so that it appears the same when rotated 180 degrees. In other words, Strobogrammatic Number appears the same right-side up and upside down.
0 after 180° rotation : (0 → 0)
1 after 180° rotation : (1 → 1)
8 after 180° rotation : (8 → 8)
6 after 180° rotation : (6 → 9)
9 after 180° rotation : (9 → 6)
Input : n = 2 Output : 88 11 96 69 Input : n = 4 Output : 8008 1001 9006 6009 8888 1881 9886 6889 8118 1111 9116 6119 8968 1961 9966 6969 8698 1691 9696 6699
Below is the Python3 implementation :
['818', '111', '916', '619', '808', '101', '906', '609', '888', '181', '986', '689']
- Count number of triplets with product equal to given number with duplicates allowed
- Count number of trailing zeros in Binary representation of a number using Bitset
- Maximum number formed from array with K number of adjacent swaps allowed
- Find minimum number to be divided to make a number a perfect square
- Number of possible permutations when absolute difference between number of elements to the right and left are given
- Number of times the largest perfect square number can be subtracted from N
- Given number of matches played, find number of teams in tournament
- Find the total number of composite factor for a given number
- Represent a number as a sum of maximum possible number of Prime Numbers
- Find the smallest number whose digits multiply to a given number n
- Find the maximum number of composite summands of a number
- Check if a number is divisible by all prime divisors of another number
- Querying maximum number of divisors that a number in a given range has
- Find the number of ways to divide number into four parts such that a = c and b = d
- Count Number of animals in a zoo from given number of head and legs
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.