less than 1 minute read

Given a string s containing digits, return whether it contains consecutively descending integers.

Constraints

  • n ≤ 10 where n is the length of s

https://binarysearch.com/problems/Consecutively-Descending-Integers

Examples

Example 1

Input

  • s = 100999897

Output

  • answer = True

Explanation

[100, 99, 98, 97] is consecutively descending.

Example 2

Input

  • s = 3210

Output

  • answer = True

Solution

Leave a comment