Skip to content

Latest commit

 

History

History
15 lines (11 loc) · 629 Bytes

File metadata and controls

15 lines (11 loc) · 629 Bytes

Problem 19: The Additive Split (Splitting a String Into Descending Consecutive Values)

Problem Statement

Given a string s consisting of only digits, check if we can split it into two or more non-empty substrings such that the numerical values of the substrings are in a strictly decreasing order and the difference between numerical values of every two adjacent substrings is equal to 1.

Input Format

  • A string s of digits.

Example

Input: s = "050043"
Output: True
Explanation: s can be split into ["05", "004", "3"] with numeric values [5, 4, 3].

Input: s = "9080701"
Output: False