Leetcode Biweekly Contest 86 Speedrun || Finishing in 25 minutes with Commentary

Поділитися
Вставка
  • Опубліковано 28 січ 2025

КОМЕНТАРІ • 27

  • @kofler9281
    @kofler9281 2 роки тому +2

    I did the D using a multiset for finding the max charging time, and using an all over sliding window concept. This maybe a easier way to do it, this solution was accepted in the contest.

    • @kofler9281
      @kofler9281 2 роки тому

      And I sorted multiset in decresing order, i.e- multiset

  • @Itskaintmeenu
    @Itskaintmeenu 2 роки тому

    hi nice sharing

  • @sohamm20
    @sohamm20 2 роки тому +2

    It took 52 minutes for me... Did last question with sparce table+binary search

    • @justjie1008
      @justjie1008 2 роки тому

      He also did it with sparse table + binary search but he named it dp

    • @depression_plusplus6120
      @depression_plusplus6120 2 роки тому

      Nice overkill
      But just a multiset would have worked

  • @danishsharma496
    @danishsharma496 2 роки тому +1

    So. You are the guy who. Finishes contest in 5 mins

    • @Harisamsharma
      @Harisamsharma  2 роки тому +2

      Lol no, that is someone named 'pathetic dog'

    • @danishsharma496
      @danishsharma496 2 роки тому

      @@Harisamsharma man you post video on for. All contest, saw your Codeforces that's awesome, I just managed to. Solve 3 question should. I. Solve code forces or restrict myself to leetcode until I get better with 4 question

    • @Harisamsharma
      @Harisamsharma  2 роки тому +2

      ​@@danishsharma496go for codeforces regardless of how good you are. you will improve much faster.​

    • @danishsharma496
      @danishsharma496 2 роки тому

      @@Harisamsharma I am also doing stiver dsa sheet should I complete that first

  • @satyammourya934
    @satyammourya934 2 роки тому +2

    Your code for 4th question seems to be nlogn (O(1) in query max from sparse table hardware specific operation)
    I too tried Nlog^2(N) using multiset but it gave TLE then coded nlogn using (sliding window max)+binary search
    PS:ended up in 21 mins but one penalty so finish time 26 mins🥲

    • @grishound
      @grishound 2 роки тому +1

      Wait so a segment tree for max and binary search gave TLE even in C++ ? I tried that approach but just thought that the TLE was because of Python.

    • @satyammourya934
      @satyammourya934 2 роки тому

      @@grishound yeah Nlog^2N TLE in cpp also🥲

  • @activeperson1799
    @activeperson1799 2 роки тому +3

    My code for 2nd question:
    return false;

  • @sharath2003
    @sharath2003 2 роки тому

    Hi, Can you please tell me how much math is needed to get good at cp and what are the maths topics one should cover before starting cp for beginners It would be helpful if you answer .thanks in advance!

    • @Harisamsharma
      @Harisamsharma  2 роки тому

      Only basic number theory(gcd, factors, etc) and basic combinatorics are needed.

  • @samagrapathak3854
    @samagrapathak3854 2 роки тому

    we also maintain a multiset for maximum na ?

  • @parthpawar7837
    @parthpawar7837 2 роки тому

    I did D with 2 pointers, but not sure why it works. Would you have an idea?

    • @justjie1008
      @justjie1008 2 роки тому

      Are you referring to sliding window?

    • @sahilkumar-uk7nw
      @sahilkumar-uk7nw 2 роки тому

      i used segment tree + two pointer.. segment tree to get maximum of a range

    • @parthpawar7837
      @parthpawar7837 2 роки тому

      @@justjie1008 Yes

  • @vedkorla300
    @vedkorla300 2 роки тому +2

    Hi dude, I am able to think of solutions easily but I am pathetic at debugging and STL. I can think of the solutions but I feel too demotivated that I haven't learned it properly, any suggestions.