# Leetcode 306 - Additive numbers

`Note:`

- Classic
`DFS`

problem. - Avoid using
`global bool`

as the result. Try to make the most of`recursion`

. Such as using`recursion(next_call)`

in if-else condition. - Have to preserve the
`2 proceding nums`

so that we can quickly check next num. - In the main function, we need to
`initialize`

the first 2 nums.

`Question:`

Additive number is a string whose digits can form additive sequence.

A valid additive sequence should contain at least three numbers. Except for the first two numbers, each subsequent number in the sequence must be the sum of the preceding two.

Given a string containing only digits ‘0’-‘9’, write a function to determine if it’s an additive number.

Note: Numbers in the additive sequence cannot have leading zeros, so sequence 1, 2, 03 or 1, 02, 3 is invalid.

`Example:`

1 | Input: "112358" |

`Code:`

1 | /** |