Minimum Limit of Balls in a Bag | Detailed | Why Binary Search | Leetcode 1760 | codestorywithMIK

Subscribers:
92,300
Published on ● Video Link: https://www.youtube.com/watch?v=5gtuhc-a_DQ



Duration: 0:00
8,927 views
554


Whatsapp Community Link : https://www.whatsapp.com/channel/0029Va6kVSjICVfiVdsHgi1A
This is the 35th Video of our Playlist "Binary Search : Popular Interview Problems" by codestorywithMIK

In this video we will try to solve a good Binary Search problem : Minimum Limit of Balls in a Bag | Wrong Approach | Why Binary Search | Leetcode 1760 | codestorywithMIK
This is a very famous topic - "Binary Search On Answer" because the statement clearly mentions "Minimize the Maximum Penalty".
Whenever you see statements in which we have to either "Minimize the Maximum Value" or "Maximize the Minimum value", go for Binary Search On Answer.

I will explain the intuition so easily that you will never forget and start seeing this as cakewalk EASYYY.
We will do live coding after explanation and see if we are able to pass all the test cases.
Also, please note that my Github solution link below contains both C++ as well as JAVA code.

Problem Name : Minimum Limit of Balls in a Bag | Wrong Approach | Why Binary Search | Leetcode 1760 | codestorywithMIK
Company Tags : Amazon OA
My solutions on Github(C++ & JAVA) - https://github.com/MAZHARMIK/Interview_DS_Algo/blob/master/Arrays/Binary Search/Minimum Limit of Balls in a Bag.cpp
Leetcode Link : https://leetcode.com/problems/minimum-limit-of-balls-in-a-bag


My DP Concepts Playlist :    • Roadmap for DP | How to Start DP ? | ...  
My Graph Concepts Playlist :    • Graph Concepts & Qns - 1 : Graph will...  
My Recursion Concepts Playlist :    • Introduction | Recursion Concepts And...  
My GitHub Repo for interview preparation : https://github.com/MAZHARMIK/Interview_DS_Algo
Instagram : https://www.instagram.com/codestorywithmik/
Facebook : https://www.facebook.com/people/codestorywithmik/100090524295846/
Twitter : https://twitter.com/CSwithMIK
Subscribe to my channel :    / @codestorywithmik  

╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝

Summary :
The problem is solved using binary search on the possible values of the maximum ball size (mid). The goal is to minimize the largest size of any ball after performing at most maxOperations splits.

Define the Search Range:

The smallest possible ball size is 1, and the largest is the maximum value in the nums array (max(nums)).
Binary Search:

For each midpoint (mid) in the range, check if it's possible to make all ball sizes ≤ mid using at most maxOperations.
Helper Method (isPossible):

For each ball, calculate the number of operations needed to reduce its size to ≤ mid.
If the total operations exceed maxOperations, mid is not feasible.
Update Search Range:

If mid is feasible, try smaller values (r = mid - 1) to minimize the result.
Otherwise, increase mid (l = mid + 1) to find a feasible solution.
Result:

The smallest feasible mid is the answer.

✨ Timelines✨
00:00 - Introduction

#MIK #mik #Mik
#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #design #data #google #video #instagram #facebook #leetcode #computerscience #leetcodesolutions #leetcodequestionandanswers #code #learning #dsalgo #dsa #coding #programming #100daysofcode #developers #techjobs #datastructures #algorithms #webdevelopment #softwareengineering #computerscience #pythoncoding #codinglife #coderlife #javascript #datascience #leetcode #leetcodesolutions #leetcodedailychallenge #codinginterview #interviewprep #technicalinterview #interviewtips #interviewquestions #codingchallenges #interviewready #dsa #hindi #india #hindicoding #hindiprogramming #hindiexplanation #hindidevelopers #hinditech #hindilearning #helpajobseeker #jobseekers #jobsearchtips #careergoals #careerdevelopment #jobhunt #jobinterview #github #designthinking #learningtogether #growthmindset #digitalcontent #techcontent #socialmediagrowth #contentcreation #instagramreels #videomarketing #codestorywithmik #codestorywithmick #codestorywithmikc #codestorywitmik #codestorywthmik #codstorywithmik #codestorywihmik #codestorywithmiik #codeistorywithmik #codestorywithmk #codestorywitmick #codestorymik #codestorwithmik




Other Videos By codestorywithMIK


2024-12-12Continuous Subarrays | Detailed Approaches | Time Complexity | Leetcode 2762 | codestorywithMIK
2024-12-11Find Score of an Array After Marking All Elements | 2 Approaches | Leetcode 2593 | codestorywithMIK
2024-12-10Take Gifts From the Richest Pile | Simple Explanation | Leetcode 2558 | codestorywithMIK
2024-12-09Maximum Beauty of an Array After Applying Operation | 3 Approaches | Leetcode 2779 |codestorywithMIK
2024-12-08Find Longest Special Substring That Occurs Thrice I & II | Leetcode 2981 & 2982 | codestorywithMIK
2024-12-08You will never have to ❤️
2024-12-08Sorry System Stack 🥹
2024-12-07Primality Check | Sieve of Eratosthenes | Super Detailed For Beginners | codestorywithMIK
2024-12-07Special Array II | 3 Detailed Approaches | Beginners Alert | Leetcode 3152 | codestorywithMIK
2024-12-06Two Best Non-Overlapping Events | Brute Force | Better | Leetcode 2054 | codestorywithMIK
2024-12-05Minimum Limit of Balls in a Bag | Detailed | Why Binary Search | Leetcode 1760 | codestorywithMIK
2024-12-04Maximum Number of Integers to Choose From a Range I | Simple | Leetcode 2554 | codestorywithMIK
2024-12-03Move Pieces to Obtain a String | Brute Force | Wrong | Optimal | Leetcode 2337 | codestorywithMIK
2024-12-02Make String a Subsequence Using Cyclic Increments | Similar Problem |Leetcode 2825 |codestorywithMIK
2024-12-01Consistency is 🔑
2024-12-01Adding Spaces to a String | Straight Forward Easy | Leetcode 2109 | codestorywithMIK
2024-11-29Check If N and Its Double Exist | Special Motivation | Leetcode 1346 | codestorywithMIK
2024-11-28Hierholzer's Algorithm | Valid Arrangement of Pairs | Leetcode 2097 | Graph Concepts & Qns - 43
2024-11-28Euler Path | Euler Circuit | PART-3 | Graph Concepts & Qns - 42 | Explanation + Code
2024-11-28November Leetcode Badge, 2024
2024-11-27Minimum Time to Visit a Cell In a Grid | Using Studied Concept | Leetcode 2577 | codestorywithMIK