2910. Minimum Number of Groups to Create a Valid Assignment | Weekly Leetcode 368

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 ม.ค. 2025

ความคิดเห็น • 14

  • @ramakantchhangani8627
    @ramakantchhangani8627 ปีที่แล้ว

    Presentation is awesome. Keep up

  • @fane1159
    @fane1159 ปีที่แล้ว

    me tried to apply the unbounded knapsack , but still getting error

  • @loserfruit9663
    @loserfruit9663 ปีที่แล้ว

    Didn't understand 4 equations where remainders are involved part

  • @RahulSaini-vs6fs
    @RahulSaini-vs6fs ปีที่แล้ว

    Great Solution👍

  • @sanjai_rs7
    @sanjai_rs7 9 หลายเดือนก่อน

    Bro can you share your CF handle. Just to take a look into it.😅

    • @codingmohan
      @codingmohan  9 หลายเดือนก่อน

      pk842. But I don't participate now, so bit stale :)

  • @samrj444
    @samrj444 ปีที่แล้ว

    Can you explain the intuition behind 0

    • @pragunbhutani1164
      @pragunbhutani1164 ปีที่แล้ว

      Yes Please explain it , cannot understand it

    • @anant9283
      @anant9283 ปีที่แล้ว +1

      The equation i) (a+b)*x + b equates to c means its possible to find an integer pair of (a,b) such that a solution exists. Now consider the second equation [(a+1)*x]+[(b-1)*(x+1)] which equates to (a+b)*x + b - 1, from the equation 1, (a+b)*x + b = c so this equation becomes c - 1 which indeed can be considered as another freq k (k = c - 1) so a pair (a+1,b-1) is valid for this equation. From the equations [0+x] + [(b+a)*(x+1)] and other one (just below this) we are trying to find the range of freq such that an integer pair(a,b) exists. Here we are not concerned about the values of a and b but is it possible to find one so we found the extremes for a given x means the range from which a freq should belong inorder to get an integer pair of solution(a,b). Now the range comes out to be 0 to max value a can take. Now the question is how to find the max value a can take. It's really easy consider all the freq coming out from x means (c/x) so the upper limit becomes c/x. Now we can see any freq with a possible solution is just multiple of (a+b) with x and a reminder which lies btw our 2 extremes 0 and c/x, so if 0

    • @codingmohan
      @codingmohan  ปีที่แล้ว +1

      Thanks for explaining.
      Just to clarify it further - you can think of it as the difference between when we take x and “x+1” is that the later is just 1 number up.
      Hence whenever you get some number and you are trying to divide into some x (a times) and some x+1 (b times), you can think of it as all of them are x (a+b times) and the extra ones (b times) are because of x+1. And number of 1s can be anywhere between 0 and c/x (maximum integer value of a that is possible).

    • @pratyanchdongre7343
      @pratyanchdongre7343 ปีที่แล้ว

      @@codingmohan i understand it very very clearly.

  • @anshugupta3269
    @anshugupta3269 ปีที่แล้ว

    thank you !

  • @gauravmandal01
    @gauravmandal01 ปีที่แล้ว

    CAN YOU PROVIDE THE NEXT QUETION

    • @codingmohan
      @codingmohan  ปีที่แล้ว +6

      Sorry for the late upload - World cup :)
      Here you go - th-cam.com/video/1KPNq_7umpo/w-d-xo.html