What is the problem with following code?


I am getting sample test case passed,but it is producing wrong answer.

@chhabrapiyush480 Can you send me the link to the problem. I would like to try a sample cases and submit your code. Also I think that your code is almost correct and there must be a slight mistake in your code. So I would also recommend you to make a few cases and try to dry run the code. As you are very close to the solution.

hi https://www.hackerrank.com/challenges/cube-summation/problem this link is given in problem statement for original problem.

@chhabrapiyush480 Did you identify your bug in the code?

I tried it ,but was unable to identify bug in my solution.

But i still cant get what was problem in my code,although this(your) approach is much easier and better.But i was doing almost same thing.

Sorry i was relying to someone else.And were you able to find bug?

@chhabrapiyush480 no I couldn’t find any bug.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.