We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Thank you for answering in such detail.
You gave an example above considering 4 elements - '1 2 4 4'.
I think you have explaned it wrongly. What my code does is this:
t = 1
if 1 >= 1 (which is true) then s = 0+1 = 1
if 2 >= 1 (which is true) then s = 1+1 = 2
if 4 >= 1 (which is true) then s = 2+1 = 3
if 4 >= 1 (which is true) then s = 3+1 = 4
So the answer by my code is 4 which is definitely wrong but now with your example I totally understood where I was wrong.
Thank you
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Birthday Cake Candles
You are viewing a single comment's thread. Return to all comments →
Thank you for answering in such detail. You gave an example above considering 4 elements - '1 2 4 4'. I think you have explaned it wrongly. What my code does is this:
t = 1
So the answer by my code is 4 which is definitely wrong but now with your example I totally understood where I was wrong. Thank you