Back
Close
  • 7

Learning Opportunities

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

Statement

 Goal

Given two integers, low and high, return how many strobogrammatic numbers are present in that range, inclusive.

A strobogrammatic number is a number whose numeral is rotationally symmetric, so that it appears the same when rotated 180 degrees. In other words, the numeral looks the same right-side up and upside down (e.g., 69, 96, 1001).

The first few strobogrammatic numbers are:
0, 1, 8, 11, 69, 88, 96, 101

Source:
https://en.wikipedia.org/wiki/Strobogrammatic_number
Input
Line 1: The lower integer of the range
Line 2: The higher integer of the range
Output
Line 1: The number of strobogrammatic numbers in the range
Constraints
0 ≤ low ≤ 10¹⁷
0 ≤ high ≤ 10¹⁷
lowhigh
Example
Input
1
70
Output
4

A higher resolution is required to access the IDE