Code Room
CodingMediumcod-g363
Subject RecursionLevel Mid–Senior~30 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

Given a string num of digits (length 1..30), split it into a sequence of non-negative integers that forms a Fibonacci-like sequence: every number (from the third on) equals the sum of the previous two. The sequence must have at least 3 numbers, no number may have a leading zero (except the single digit '0'), and every value must fit in a signed 32-bit integer (< 2^31). Return any one valid split as a list of integers, or an empty list if none exists.

Implement
split_into_fibonacci(num: str) → list[int]
Examples
in["1101111"]out[11,0,11,11]
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.