Tap here to switch tabs
Problem
Submissions

Problem: Split Array into Fibonacci Sequence

med
30 min
Try to solve the Split Array into Fibonacci Sequence problem.

Statement

Given a string of digits num, split it into a sequence of integers ans that satisfies the following conditions:

  • The length of ans is at least 33.

  • ans[i] ++ ans[i + 1] == ans[i + 2] for all 0≤i<0 \le i < ans.length −2- 2.

  • Each element in ans fits within a signed 3232 bit integer, meaning 0≤0 \le ans[i] ≤231−1\le 2^{31} - 1.

  • No element contains leading zeros, except for the value 00 itself.

  • Concatenating the elements of ans in order reproduces the original string num.

Return any valid sequence ans. If no such sequence can be formed, return an empty list.

Constraints:

  • 1≤1 \le num.length ≤200\le 200

  • num contains only digits.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Split Array into Fibonacci Sequence

med
30 min
Try to solve the Split Array into Fibonacci Sequence problem.

Statement

Given a string of digits num, split it into a sequence of integers ans that satisfies the following conditions:

  • The length of ans is at least 33.

  • ans[i] ++ ans[i + 1] == ans[i + 2] for all 0≤i<0 \le i < ans.length −2- 2.

  • Each element in ans fits within a signed 3232 bit integer, meaning 0≤0 \le ans[i] ≤231−1\le 2^{31} - 1.

  • No element contains leading zeros, except for the value 00 itself.

  • Concatenating the elements of ans in order reproduces the original string num.

Return any valid sequence ans. If no such sequence can be formed, return an empty list.

Constraints:

  • 1≤1 \le num.length ≤200\le 200

  • num contains only digits.