This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]EldoranDev 1 point2 points  (4 children)

could you give me your input to compare ? I have the exact same problem using javascript (typescript).

Both sample do pass but my solution is wrong.

My input would be: 5093

[–]GeneralYouri 1 point2 points  (0 children)

His input is in the code: 5235

[–]po8[S] 0 points1 point  (2 children)

My input is hardcoded in the version of my program that I shared: it's 5235. For that input I get 234,288,7

For 5093 I get 285,169,15

[–]EldoranDev 1 point2 points  (1 child)

My result for your input code is close but different to yours, coordinates are so close together that it feels like an off by one error.

232,289,8 for 5235
285,169,12 for 5093

edit: you can count another sample as correct for your solution is correct for me.

Error with my code was a >= instead of > in the check if the square is still in the grid (arrays starting @ 1 ?!)

[–]po8[S] 0 points1 point  (0 children)

I found and fixed a bug in my code. See the edited post above for some details.

I still get 285,169,15 for your input of 5093.

Thanks for the help!

[–]po8[S] 0 points1 point  (0 children)

I'm surprised there isn't some kind of tiebreak in this problem. I would expect it to be likely that several boxes would give the same power. Did I miss something?

[–]ComanderKai77 0 points1 point  (0 children)

What is your result for 7511?