Leetcode Biweekly Contest 94 | 2513 : Minimize the Maximum of Two Arrays Solution | Newton School

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

КОМЕНТАРІ • 18

  • @KaranMashru
    @KaranMashru 2 роки тому +4

    (Subscribe for more such videos)
    Code :
    class Solution {
    public:
    long gcd(long a, long b)
    {
    if((a%b)==0){
    return b;
    }else{
    return gcd(b, a%b);
    }
    }

    void bs(long l, long h, int divisor1, int divisor2, long lcm, long * ans, int c1, int c2){
    if(l

  • @aseembaranwal
    @aseembaranwal 8 місяців тому

    WHat is the reason to choose 10^10 as the upper limit for the search space?

  • @securelyinsaycure
    @securelyinsaycure 9 місяців тому

    Very helpful video thank you so much!!!

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

    Bhai atcoder ke solution bhi post kiya kro , kaafi helpful h tmhre video

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

    app bahut accha padhate ho kash mai 3rd year m apka channel dekha hota

  • @LogicArena01
    @LogicArena01 Рік тому

    Thanks for that explanation...❤

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

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

    oh..bhai...mza agya....I like the explanation which is beginner friendly. Thanks

  • @SB_09124
    @SB_09124 Рік тому

    Very nice explanation ...#concept clearr👍👍

  • @socify4410
    @socify4410 Рік тому +1

    bhaii sab kya question tha and kya explaination hai

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

    Good job

  • @DeepSingh-zs2oi
    @DeepSingh-zs2oi 2 роки тому

    very good explanation

  • @factholicdunyia2049
    @factholicdunyia2049 Рік тому

    Very well explained.. thanku sir

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

    @Karan Mashru
    #include
    class Solution {
    public:
    int find_gcd(int a , int b){
    if(b == 0)return a ;
    else return find_gcd(b , a % b) ;
    }
    public:
    bool check(int divisor1 , int divisor2 , int uniqueCnt1 , int uniqueCnt2 , int mid , int lcm){

    int temp1 = mid - mid/divisor1 , temp2 = mid - mid/divisor2 ;

    int temp3 = mid - (mid/divisor1 + mid/divisor2 - (mid / lcm)) ;
    int temp4 = mid - (mid / lcm) ;
    if((temp1 >= uniqueCnt1) && (temp2 >= uniqueCnt2) && ((temp1 + temp2 - temp3) >= (uniqueCnt1 + uniqueCnt2)))return true ;
    else return false ;

    }
    public:
    int minimizeSet(int divisor1, int divisor2, int uniqueCnt1, int uniqueCnt2) {
    int lo = 1 , hi = INT_MAX , ans = 0 ;
    int lcm = ((long long)divisor1 * (long long)divisor2) / find_gcd(divisor1 , divisor2) ;

    while(lo

    • @ankitaryan5153
      @ankitaryan5153 Рік тому

      just use long it will give you correct answer