Strobogrammatic Number — LeetCode

Soren Rood
Jan 7, 2021

Here is the question:

LeetCode #246

Companies that have asked it recently:

Facebook
Cisco, Google, Microsoft

This is my solution:

https://carbon.now.sh

I created a map that contains numbers 0–9. The value for the keys is the number upside down. If it is not a number upside down, I set it to 0.

For every x in num, we append it’s “upside-down” value to a string. We then return true if the reversed string is == to the input num.

--

--