553. Additive Sequence
0
Easy
An additive number is a string that can be split into an additive sequence.
An additive sequence is a sequence of numbers where each number (starting from the third number) is the sum of the preceding two numbers.
Given a string containing only digits, determine if it can be split into an additive sequence. Return true if it can, and false otherwise.
Input Format
The input consists of a single line containing a string of digits.
Output Format
Output a single line containing either 'true' or 'false'.
Example
Input
112358
Output
true
Constraints
1 <= s.length <= 35
String *s* consists only of digits.
String *s* consists only of digits.
Loading...
View Submissions
Console