Please explain solution to this problem-
Hi!
I used simple Brute Force to solve this problem. Here is my code.
EXPLANATION:
Notice that N is just 8 in the worst case. This provides one a hint to try Brute Forcing. Basically, all I did was - for every bamboo, I decided to either :
- Not use it, or
2)Use it to form A, or - Use it to form B, or
- Use it to form C
I did this recursively and took the minimum cost of all possible combinations.
Feel free to ask if something is unclear.
Hope this helped
yeah got it!!.. thanks a lot.