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.
According to problem statement x>=2 and k>= 1 and k<=x ;
so for example if n=4;
coin =0 (initially)
4=>{2,2}
since k >=1
left {2} and coin=1^2=1
now 2=>{1,1} i.e. x=2;
now take both coin 2^2=4
so answer = 1+4=5
then why 6 in testcase ...
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Tower Breakers - The Final Battle
You are viewing a single comment's thread. Return to all comments →
According to problem statement x>=2 and k>= 1 and k<=x ;
so for example if n=4; coin =0 (initially) 4=>{2,2} since k >=1 left {2} and coin=1^2=1 now 2=>{1,1} i.e. x=2; now take both coin 2^2=4 so answer = 1+4=5 then why 6 in testcase ...