Leetcode Weekly Contest 414 | Video Solutions - A to D | by Viraj Chandra | TLE Eliminators

Поделиться
HTML-код
  • Опубликовано: 18 сен 2024

Комментарии • 48

  • @TLE_Eliminators
    @TLE_Eliminators  11 дней назад +2

    Please fill the feedback form for PCD: forms.gle/qGQqEaVYeAvR7sZr8

  • @A_Myth963
    @A_Myth963 10 дней назад +7

    Only one request from this channel coordinators....plzzzzzz keep this guy only for leetcode discussion...it my humble request to you guys

  • @instinct1098
    @instinct1098 8 дней назад +4

    I don’t comment mostly but the way 4th question was explained man too great. Best explanation

  • @nagatanujabathena6319
    @nagatanujabathena6319 7 дней назад +2

    Explanation to the 4th question is simple Amazing. The best explanation one can get from a hard problem. Thank you so much!

  • @manibhushankumarsingh5196
    @manibhushankumarsingh5196 11 дней назад +15

    Better than other teachers explanation on this channel!!

  • @abidaziz9809
    @abidaziz9809 11 дней назад +5

    Best explanation 👌

  • @ayaaniqbal3531
    @ayaaniqbal3531 11 дней назад +4

    Nice Explanation .

  • @lovescience9004
    @lovescience9004 11 дней назад +3

    Great explanation. Thank you.

  • @pranavsharma6512
    @pranavsharma6512 11 дней назад +8

    Applied DP on 3rd and stuck on test case 601

    • @saurabhchamoli5204
      @saurabhchamoli5204 11 дней назад +2

      Same

    • @sugatalaha4214
      @sugatalaha4214 11 дней назад +1

      Everyone fell into the same trap. I wonder how one could come up with greedy solution

    • @he-harshedits361
      @he-harshedits361 11 дней назад +1

      Read the constraints and left it at once, cauz dp was not gonna work😢

    • @YashwanthsaiCh
      @YashwanthsaiCh 11 дней назад +1

      @@he-harshedits361 how did you know dp is not going to work after reading constraints?

    • @anshumantiwari574
      @anshumantiwari574 11 дней назад +3

      @@YashwanthsaiCh The most efficient Dp solution had time complexity of O(n^2) and the constraint was 10^5 so it would give tle that's why it was useless to apply DP there.

  • @mridul1075
    @mridul1075 11 дней назад +3

    wow man, what a explaination

  • @rajchinagundi7498
    @rajchinagundi7498 11 дней назад +8

    q2 explanation ? Wasnt explained well. Take it as a constructive criticism.

    • @VirajChandra
      @VirajChandra 10 дней назад

      Hi, what seemed missing?

    • @khalidalam980
      @khalidalam980 9 дней назад +1

      @@VirajChandra In the contest itself i'm able figure out it's a BS problem but not able to write Checker function. After watching this also not able to understand. I tried several videos but can't figure it out.
      eg:- [8, 0, 4] d=2
      sort [0, 4, 8]
      range becomes [[0, 2], [4, 6], [8, 10]] Let say mid = 1 Which numbers should be taken from the range to make minimum abs difference to be mid=1.

    • @AbhishekKumar-lp7wy
      @AbhishekKumar-lp7wy 8 дней назад

      @@khalidalam980 You dont have to make diff exactly equal to one it might be >=1 as well

  • @kishorereddykancherla8210
    @kishorereddykancherla8210 11 дней назад +2

    one more observation on the last one, the dp array can be 2d. since any nth turn cant be played by both a and b, just dp on cur, mask would also suffice

    • @VirajChandra
      @VirajChandra 10 дней назад

      Correct! This is an optimisation on Alice Bob game problems.

  • @Sridhar-fd5qr
    @Sridhar-fd5qr 10 дней назад +1

    Great explanation

  • @arl0817osho
    @arl0817osho 10 дней назад +1

    viraj bhaiya I am very weak at rerooting dp, can you explain some of lc problems involving rerooting because your explanation is something else.

  • @pabitrakb5291
    @pabitrakb5291 11 дней назад +2

    Nice explanation

  • @vamsikrishnagannamaneni912
    @vamsikrishnagannamaneni912 6 дней назад +1

    Great explanation on problem 2.Need socials of the guy explaining.. why are they not posted in the description? Not even a name? lol

    • @VirajChandra
      @VirajChandra 5 дней назад

      Hi, my is Viraj. It’s in the title.😅

  • @shauryasinghal-dt1qg
    @shauryasinghal-dt1qg 11 дней назад +1

    Brilliant viraj

  • @Authenticbharatiya
    @Authenticbharatiya 6 дней назад +2

    @VirajChandra why did you push knight's position coordinates in positions 2d vector? Like we can directly call the recursive function from the knight's position without adding it in positions vector???

    • @VirajChandra
      @VirajChandra 5 дней назад

      I’m using that position in the preprocess function.

    • @Authenticbharatiya
      @Authenticbharatiya 5 дней назад +2

      @@VirajChandra sorry sir i still didn't understand. Like even in leetcode hint section they have told to consider the knight's original position as another pawn. why is it so? As for preprocess function we are actually just using the constraints given in the problem and aren't using any info about positions of pawns.

    • @VirajChandra
      @VirajChandra 4 дня назад +1

      @@Authenticbharatiya So in the preprocess function, we are trying to find the minimum moves required to go from each point to each point. To do this, we need in the positions array, and in that we also need the knight's position to be added so that in the preprocess function it gets treated as a point and we are able to calculate minimum moves from it to other points.

    • @Authenticbharatiya
      @Authenticbharatiya 4 дня назад

      @@VirajChandra understood sir. thanks a lot!!!

  • @shivank630
    @shivank630 10 дней назад +2

    int dist[50][50][50][50];
    int dx[]={1,2,2,1,-1,-2,-2,-1};
    int dy[]={-2,-1,1,2,2,1,-1,-2};
    class Solution {
    public:
    void calcdistance(int kx, int ky) {
    queue q;
    q.push({0,{kx,ky}});
    dist[kx][ky][kx][ky]=0;
    while(q.size()) {
    int d = q.front().first;
    int x = q.front().second.first;
    int y = q.front().second.second;
    q.pop();
    for(int i=0;i=0 and newx=0 and newy

    • @VirajChandra
      @VirajChandra 9 дней назад

      Can you send submission link?

  • @ayushbalodhi7804
    @ayushbalodhi7804 11 дней назад +4

    q2😥

  • @leftover19
    @leftover19 4 дня назад +1

    why do we need a mask ? can't we simply use a visited array ?

    • @VirajChandra
      @VirajChandra 3 дня назад

      It would be not viable to maintain visited array as a state

  • @cricketsureshlucky
    @cricketsureshlucky 11 дней назад +1

    Can we count elements greater than nums[0]until n-1 will that workk?? (Question 3)

    • @VirajChandra
      @VirajChandra 10 дней назад +1

      Can you give some more details of your idea?

    • @cricketsureshlucky
      @cricketsureshlucky 10 дней назад

      For example 4,5,3,8,9,5,5,2 his idea is taking 4,5,8,9.my idea is taking 4,5,8,9,5,5

    • @VirajChandra
      @VirajChandra 9 дней назад

      I think you get a lower answer from this.

  • @shreyanshjain1595
    @shreyanshjain1595 11 дней назад +3

    Very poor explanation for problem B