Code Room
CodingEasycod-g1491
Subject Dynamic programming 1dLevel Entry–Mid~12 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

Count the ordered ways to write a non-negative integer n as a sum of parts where every part is 2 or 3. Order matters: 2+3 and 3+2 are different. Return the count; return 1 for n = 0 (the empty sum) and 0 when no such sum exists (for example n = 1). For example, n = 5 has two ways (2+3 and 3+2), and n = 7 has three (2+2+3, 2+3+2, 3+2+2).

Implement
count_two_three_sums(n: int) → int
Examples
in[5]out2
in[7]out3
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.