Meet In The Middle Technique | Leetcode Partition Array Into Two Arrays to Minimize Sum Difference

Meet In The Middle Technique | Leetcode Partition Array Into Two Arrays to Minimize Sum Difference | CSES Problem set
🔥Linkedin: / anmol-agarwal-674a21166
🔥Insta: / anmolagarwal8601
🔥Telegram: : t.me/+i4YTtNUUq_diNDA1
Ignore theseTags:
Anmol Agarwal
how to build logic in programming
logic building in programming
how to build programming logic
how to solve coding problems
problem solving skills for programming
programming logic for beginners
how to improve problem solving skills in programming
how to develop logic in programming
programming logic
how to build logic skills in programming
how to improve coding skills
how to improve programming logic
how to improve logical thinking skills in programming
Anmol Agarwal
how to improve programming skills
how to improve coding logic skills
Anmol Agarwal
Anmol Agarwal c++
dsa
logic building
how to improve logic building skills in programming
how to improve logic in programming
time complexity
how to approach coding problems
programming for problem solving
how to solve programming problems
how to improve problem solving skills
how to develop programming logic skills
how to build logic in java programming
competitive programming
data structures and algorithms
how to make logic in programming
problem solving skills
logic building in java programming
how to approach
how to approach a coding question
bit manipulation
how to solve competitive programming problems
c language tutorial for beginners
dynamic programming problems
how to think logically in programming
java by Anmol Agarwal
logic programming
java anuj bhaiya
logic in programming
programming
recursion
improve logical thinking for programming
java programming
programming problem solving
coding problems
how to improve logical thinking skills
problem solving programming
c programming for beginners
how to increase logical thinking for programming
c language
coding motivation
data structure and algorithm
how to build a logic for programming
how to develop problem solving skills in programming
how to improve coding
logic development for programming
c programming
dynamic programming
how to approach a coding problem
java
java tutorial
java tutorial for beginners
program logic development
competitive coding for beginners
ds algo
dsa in java
how to develop coding skills
how to develop problem solving skills
Anmol Agarwal
how to increase problem solving skills
logical programming
Anmol Agarwal dsa
c++ programming
get saged
how to improve logic building in programming
logical thinking for programming
love babbar
python for beginners
solving coding problems
build logic for programming
c++
code with harry
coding tips
competitive programming tutorial
dsa java
dsa tutorial
how to be a good programmer
how to develop logical thinking in programming
how to increase problem solving skills in programming
how to learn logic building in programming
logic for programming
machine learning
programming skills
python full course
recursion in java
backtracking
bit manipulation playlist c++
c++ tutorial for beginners
coding for beginners
competitive programming java
dsa course
dsa problem solving
dsa roadmap
how to build logic
how to create logic in programming

Пікірлер: 27

  • @harrypotteredits7265
    @harrypotteredits7265 Жыл бұрын

    nice video very helpful

  • @divyam69
    @divyam695 ай бұрын

    was initially trying to solve this problem using memoization but it was showing memory limit exceeded but this approach was better, thanks anmol bhaiya :)

  • @happyengineeringwithanmol

    @happyengineeringwithanmol

    5 ай бұрын

    Thanks man

  • @AnshulSharma-gq2vn
    @AnshulSharma-gq2vn Жыл бұрын

    This is really good and thorough! Kudos Anmol!! Keep Going!

  • @happyengineeringwithanmol

    @happyengineeringwithanmol

    Жыл бұрын

    Thanks man

  • @nhienle5137
    @nhienle51374 ай бұрын

    Love you, thank you for the detail explanation.

  • @happyengineeringwithanmol

    @happyengineeringwithanmol

    4 ай бұрын

    Thanks

  • @summary900
    @summary900 Жыл бұрын

    thanks bro great explanation but can u explain the lower bound part in a bit depth why b should be >=(sum-2*a)/2;

  • @it-65jaskarankamboj89
    @it-65jaskarankamboj892 жыл бұрын

    nice video understood nicely :)

  • @happyengineeringwithanmol

    @happyengineeringwithanmol

    2 жыл бұрын

    Thanks man

  • @utsavmishra3132
    @utsavmishra3132 Жыл бұрын

    Bhai kya he sahi socha h Awesome !! kitna practice kiya ho bhai itna soch lane ke liye ?

  • @happyengineeringwithanmol

    @happyengineeringwithanmol

    Жыл бұрын

    Bhai tejj hi hoo bachpan sa mein😂😂 jokes apart I have been doing dsa for past 4 years.

  • @vinaygoswami5374
    @vinaygoswami5374 Жыл бұрын

    can you explain sum - 2*(1 + sum2)

  • @saunaknandi1814
    @saunaknandi1814 Жыл бұрын

    in the formula sum-2*(sum1) , why u wrote 1+sum2

  • @iloveuniverse143

    @iloveuniverse143

    11 ай бұрын

    same doubt , in example it should be 22 - 2*(3 + 7) = 2

  • @divyam69
    @divyam695 ай бұрын

    did you solve the whole cses problem sheet?

  • @happyengineeringwithanmol

    @happyengineeringwithanmol

    5 ай бұрын

    Tried to solve the maximum I could

  • @killua8762
    @killua876211 ай бұрын

    Which software are you using to write?

  • @happyengineeringwithanmol

    @happyengineeringwithanmol

    11 ай бұрын

    Obs

  • @happyengineeringwithanmol

    @happyengineeringwithanmol

    11 ай бұрын

    Good notes

  • @user-gq8he1il1p
    @user-gq8he1il1p Жыл бұрын

    full confusion bro

  • @happyengineeringwithanmol

    @happyengineeringwithanmol

    Жыл бұрын

    Watch it again

  • @vinaygoswami5374
    @vinaygoswami5374 Жыл бұрын

    here is a solution of the leetcode problem class Solution { public int minimumDifference(int[] nums) { if(nums.length == 2) return Math.abs(nums[0] - nums[1]); int total = Arrays.stream(nums).sum(); int n = nums.length / 2; HashMap map1 = new HashMap(); HashMap map2 = new HashMap(); for(int i = 0 ; i if((bitmask&1) == 1){ sumbits++; sum += nums[pos]; } pos++; bitmask = bitmask >> 1; } if(!map1.containsKey(sumbits)) map1.put(sumbits,new ArrayList()); map1.get(sumbits).add(sum); } for(int i = 0 ; i if((bitmask&1) == 1){ sumbits++; sum += nums[pos + n]; } pos++; bitmask = bitmask >> 1; } if(!map2.containsKey(sumbits)) map2.put(sumbits,new ArrayList()); map2.get(sumbits).add(sum); } for(int i = 0 ; i

  • @adityaagarwal1650
    @adityaagarwal16502 жыл бұрын

    elements can be negative also, so ig your solution is wrong.

  • @happyengineeringwithanmol

    @happyengineeringwithanmol

    2 жыл бұрын

    The solution is correct its accepted on both the platforms I feel you missed out somewhere you can join my telegram group for detailed discussion

  • @adityaagarwal1650

    @adityaagarwal1650

    2 жыл бұрын

    @@happyengineeringwithanmol i mean in the explanation it be abs(20 - 2*sum2) >= 0 and one doubt I have is auto itr = lower_bound(v.begin(), v.end(),b) for this we should also consider one iterator prior to itr also (i.e. (-- itr)) as that also give us minimum?.. right?

  • @happyengineeringwithanmol

    @happyengineeringwithanmol

    2 жыл бұрын

    @@adityaagarwal1650 even I did added that condition previously but test cases were like that my solution passed