When was the last year that looked the same upside down?
(1961)
2026 Update: Strobogrammatic Numbers — Rotation Invariant Digits
The “upside down year” puzzle: which years look the same when rotated 180°? A number is strobogrammatic if it reads the same upside down. Strobogrammatic digits: 0→0, 1→1, 6→9, 8→8, 9→6.
def is_strobogrammatic(n: str) -> bool:
"""Check if number string looks same when rotated 180 degrees."""
# Map of digits that are valid when flipped
mapping = {'0': '0', '1': '1', '6': '9', '8': '8', '9': '6'}
left, right = 0, len(n) - 1
while left list:
"""Find all strobogrammatic years in range [start, end]."""
return [y for y in range(start, end + 1) if is_strobogrammatic(str(y))]
# Find strobogrammatic years
print("Strobogrammatic years 1000-2100:")
years = strobogrammatic_years(1000, 2100)
print(years)
# [1001, 1111, 1691, 1881, 1961, 1881, 6009, 6119, 6699, 6889, 6969, ...]
# In 4-digit range: 1881, 1961, 9001, etc.
# Generate all n-digit strobogrammatic numbers
def generate_strobogrammatic(n: int) -> list:
"""Generate all n-digit strobogrammatic numbers."""
def generate(lo: int, hi: int) -> list:
if lo > hi:
return ['']
if lo == hi:
return ['0', '1', '8'] # Single digit middle of odd-length
middles = generate(lo + 1, hi - 1)
result = []
pairs = [('0', '0'), ('1', '1'), ('6', '9'), ('8', '8'), ('9', '6')]
for left, right in pairs:
for mid in middles:
if lo == 0 and left == '0':
continue # No leading zeros
result.append(left + mid + right)
return result
return generate(0, n - 1)
four_digit = generate_strobogrammatic(4)
print(f"n4-digit strobogrammatic numbers: {four_digit}")
# [1001, 1111, 1691, 1881, 1961, 6009, 6119, 6699, 6889, 6969, 8008, 8118, 8698, 8888, 8968, 9006, 9116, 9696, 9886, 9966]
print(f"Count: {len(four_digit)}")
Interview angle: Strobogrammatic number generation (LeetCode #246, #247, #248) uses recursive build-from-outside — the same structure as palindrome generation. The constraint that leading zeros are invalid is a common edge case. This puzzle also connects to typography: which letters look the same upside down (NOON, SWIMS, etc.) — the same rotation invariance principle.