Code RoomSum of twos and threes
EasyPrep Room Coding #695

Sum of twos and threes

CodingAlgorithms & data structuresEntry–Mid~12 min

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.

0:00 of about 12 min
InputExpectedGot
[5]2not run yetsample
[7]3not run yetsample