246 Strobogrammatic Number
A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down).
Write a function to determine if a number is strobogrammatic. The number is represented as a string.
For example, the numbers "69", "88", and "818" are all strobogrammatic.
The Idea: Good reference: https://oeis.org/A000787. A number is strobogrammatic if it is pair wise palindromic. That is, looking at the vertical reflection of the number, 8 maps with 8, 9 maps with 6, 1 maps with 1, ... etc.
Complexity: O(n) time and O(1) space
Last updated