Question: Trailhead is a learning platform and for every trail that you complete, you earn a badge. There are two colour of badges based on the
Trailhead is a learning platform and for every trail that you complete, you earn a badge.
There are two colour of badges based on the difficulty level of the trail.
You are very passionate about these badges, and like arranging them in a triangle as follows:
You put red badge in the St row, then put blue badges in the nd row, then red in the rd row and so on
If the row of your triangle will not suffice from the badges available, that row will not be counted in the height. This keeps you striving to learn more.
Whenever one colour of your badges get over, and you have more badges of the other, you could either make the next row with it if possible or simply make another similar triangle with only the colour left, whichever maximises the height sum of both triangles.
Can you tell him the sum of maximum possible heights of the triangles for N red badges and M blue badges?
given NM MaxINT
for n m ans is need c code
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
