69 and 818 are flip-proof, while 16 is not.
You are given two strings lower and upper holding integers without leading zeros. Count the flip-proof numbers between lower and upper, both ends included.lower='10', upper='100' → 4
The range holds 11, 69, 88 and 96.
lower='0', upper='9' → 3
Among single digits only 0, 1 and 8 are flip-proof: 6 turns into 9.
lower='600', upper='700' → 3
These are 609, 619 and 689: the middle digit has to stay itself, while the outer 6 and 9 swap places in the turn.
lower.length, upper.length ≤ 15lower and upper consist of digits only and do not start with 0 unless the number is 0 itselflower ≤ upper as numberslower='10', upper='100'
4
Run checks the first 3 tests in your browser. Submit checks all 96 tests on the server, hidden ones included.