Test for this : 100 2 3 100
Output should be 100 1 1 100 = 99+99 = 198
[hackerrank]>echo "1
> 4
> 100 2 3 100" | ./sherlock-and-cost
198
Did this Give WA ? (20 chars)
lol… its giving 198 as the ans only
I didn’t take part - just noticed the similarity in questions 
yeah… it was giving wa
Did you see the Accepted solution by gaddevarunteja ?
I did the same problem on Hackerrank, (Sherlock and Cost) months ago… everybody must have seen it 1 time on Hackerrank for sure.
If you copy-paste the exact same solution, you’ll get WA…as constraints of both problems are different. You have to make some changes I believe…
can anyone explain approach of 2nd problem ?? pls…
I did not understand the editorial can anyone explain the approach with reference to this problem ??
My solution is more fleshed-out than the Editorial, but more focussed on proof-of-correctness - hopefully it’s more comprehensible ![]()
Did anyone get AC in the actual gfg problem tho?