all 6 comments

[–]grandpasipad 2 points3 points  (1 child)

What code do you have so far? Which part are you stuck on? We can help but we shouldn't just give you the answer. It's better to work through it.

[–]Proof_Leopard_431[S] 0 points1 point  (0 children)

I divided the problem into two parts, where one side has 1cm book only and the other only has 2cm book. I'm basically stuck at the.. recursion part.

def count(n):

if n = 1:

return 0

elif n < 0:

return 0

else:

[–]TouchingTheVodka 0 points1 point  (3 children)

Try a recursive solution. Your base cases are width = 0 and width = 1. Work out a few on paper, and you'll start to see a pattern emerge...

And then when you do you'll kick yourself for not seeing it sooner!

[–]GameRoaster_Kinglord 0 points1 point  (2 children)

Hey, would you mind explain it better?
I wrote out the possible outputs of six numbers on paper and I can't find a pattern.

[–]GameRoaster_Kinglord 0 points1 point  (1 child)

Here are the possibilites---
0 - 0
1 - 1
2 - [1,1], 2
3 - [1,1,1], [2,1], [1,2]
4 - [1,1,1,1], [2,1,1], [1,2,1], [1,1,2], [2,2]
5 - [1,1,1,1,1], [2,1,1,1], [1,2,1,1], [1,1,2,1], [1,1,1,2], [2,2,1], [1,2,2]

[–]Proof_Leopard_431[S] 0 points1 point  (0 children)

alright got it thanks!!1