Topsy Turvy Numbers

Published by Matt in

Topsy turvy numbers are numbers that when inverted (rotated 180 degrees) are unchanged. The most recent topsy turvy years were 1961 and 1881. The next one won't be until 6009. Mathemeticians have shown little interest in these numbers, but Edabitians are always up for a challenge:

Write a function that accepts two non-negative integers and returns an array of all topsy turvy numbers inclusively in that range.

Examples

topsy_turvy(0, 10) ➞ [0, 1, 8]

topsy_turvy(10, 100) ➞ [11, 69, 88, 96]

topsy_turvy(1000, 2000) ➞ [1001, 1111, 1691, 1881, 1961]

Notes

N/A

Watch a quick demo on how Edabit works.