Consecutive Sweets
CodeChefOpen on judge ↗
You have n sweets before you and all of them are distinct. You are not allowed to take 2 consecutive sweets because you'll get diabetes duh.. Find the total number of ways you can select some number of sweets from n sweets. (You are health conscious and can take 0 sweets as well.) Output the number of ways modulo 109+7. Input A single line containing the number of sweets n Look at the test ca
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start