fiire_ice's blog

By fiire_ice, history, 6 weeks ago, In English

This is the leetcode problem from a recent contest: https://leetcode.com/problems/minimum-number-of-seconds-to-make-mountain-height-zero/

For some reason, this solution gives a TLE: https://ideone.com/00tSfJ.

I have an alternative solution which passes, my question is why does the above solution give TLE?

This solution should not be giving TLE because:

-the while loop can have upto 56 turns (since 2^56 > 1e8 * 1e8)

-the for loop upto 10^4 turns

-and, the map.upper_bound() would take 17 turns (since, log_base2(2^17) > log_base2(10^5) > log_base2(no. of items in map))

So overall, 9.52 * 10^6 operations. But I still get a TLE here. Please help me understand this better.

PS: I know that above is a simplification because complexity represents order of growth with respect to input size but I still don't see why the above solution should not pass.

Full text and comments »

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

By fiire_ice, history, 20 months ago, In English

Is the site working for you guys?

Full text and comments »

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

By fiire_ice, 20 months ago, In English

Can anyone tell me what Leetcode private contests are? I couldn't find info online. Also link to its private contest rules seem to be broken and I have no idea what it will entail.

Full text and comments »

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

By fiire_ice, history, 21 month(s) ago, In English

Hello Codeforces!

I recently gave a Newton Coding contest called CodeCrush on Valentine's. (of course I had nothing to do the entire day). The contest mentioned there would be prizes (in mail) but any further clarification regarding prizes has not been published as far as I have seen. On the site there is no mention of prizes, on Codeforces I really couldn't find any blog posts as well.

Can someone confirm whether there would be any prizes or not?

Full text and comments »

  • Vote: I like it
  • -16
  • Vote: I do not like it

By fiire_ice, history, 23 months ago, In English

Hello Codeforces!

Recently I gave this OA at Impact Analytics, but I couldn't understand this problem at all. The language of the problem statement isn't clear. Can someone just tell me whether the problem is correct? By that I mean can someone see if all the test inputs outputs make sense or not. Here is the problem statement

Thank you, bless you, Merry Christmas, Happy New Year!

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it