yesbutno1685's blog

By yesbutno1685, history, 6 weeks ago, In English

Problem statement:

My submission (Using binary search approach):

My submission (Using two-pointers approach):

In this problem, I came up with two approaches which seem asynchronous to the editorial's solution. One using binary search and the other using the two pointers technique. However, both of my implementations WA-ed on testcase 14 with the same exact answer. I suspect that I am either doing something wrong with my logic and implementation or it is just some sort of annoying precision kind of error. (eg, rounding wrong, not precise enough, off by like 10^-8).

I would appreciate it if anyone would point out my error, or give me a hint. I spent a long time reading through the editorial many times, but still can't find my error.

Thank's in advance!

  • Vote: I like it
  • +3
  • Vote: I do not like it

6 weeks ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

Never mind, I found out my error

UPD: Got it correct! (I just modified the behavior of my pointers in my 2 pointers code and it worked)