Back
Close
  • 51

Learning Opportunities

This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.

Statement

 Goal

When written with digits, some digits may still read when flipped (0, 1, 2, 5, 6, 8, and 9) while others mean nothing when flipped (3, 4, and 7).
Once flipped, some integers remain identical like 69, they are called "stunning numbers"!
Given an integer n, say whether it is "stunning" or not, then find the next "stunning number"...

 --          --    --          --    --    --    --    --
| | | | | | | | | | | | | |
-- -- -- -- -- -- --
| | | | | | | | | | | | |
-- -- -- -- -- -- --


-- -- -- -- -- -- --
| | | | | | | | | | | | |
-- -- -- -- -- -- --
| | | | | | | | | | | | | |
-- -- -- -- -- -- -- --

Even if the number 1 is a little off once flipped, it is considered stunning.
Input
n an integer
Output
Line 1: true if n is a "stunning number", false otherwise
Line 2: the next "stunning number".
Constraints
0 <= n <= 10^20
Example
Input
69
Output
true
88

A higher resolution is required to access the IDE