Practice Splitting a String Into Descending Consecutive Values
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Splitting a String Into Descending Consecutive Values
Problem Statement
You are given a string s that consists of only digits. Check if we can split s into two or more non-empty substrings such that the numerical values of the substrings are in descending order and the difference between numerical values of every two adjacent substrings is equal to 1. Return true if it is possible to split s as described above, or false otherwise. A substring is a contiguous sequence of characters in a string.
Source: Splitting a String Into Descending Consecutive Values on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
s = "1234"
false
# Example 2
s = "050043"
true
# Example 3
s = "9080701"
false
Constraints
Related LeetCode Problems
Practice more problems similar to Splitting a String Into Descending Consecutive Values.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.