My output is coming correct , i tried for some test cases .Still no case is passing
What is wrong in my code?
Hello @anushreemahur5,
mindist[i] may exceed int limit before adding it to the ans so use typecasting there, calculate your answer as this:
amount+=(long long)mindist[i];
Also, make amount of type long long,
Hope, this would help.
Give a like if you are satisfied.
still not passing any testcases
Hey @anushreemahur5,
In that case you must have done some mistake while implementing the logic.
Cross validate your code with:
Let me know if you still can’t find it.