🔴 2861. Maximum Number of Alloys II Weekly Contest 363 II Binary Search II Leetcode 2861

  Рет қаралды 2,083

Aryan Mittal

Aryan Mittal

Күн бұрын

Пікірлер: 10
@iamnoob7593
@iamnoob7593 6 ай бұрын
Man , This is brilliant , Thank you.
@VishalKumar-uu3xm
@VishalKumar-uu3xm Жыл бұрын
nice explaination sir ji
@RohitKumar-dy2gc
@RohitKumar-dy2gc Жыл бұрын
now ques seems so simple don't know why i afraid first after seeing it in contest
@Anonymous____________A721
@Anonymous____________A721 Жыл бұрын
🤣
@wasurvivor
@wasurvivor Жыл бұрын
I think the binary search solution fails if we think logically. Let me give you a test case n = 3, k = 3 Composition = [[1,1,10],[2,2,5]] Stock = [0,0,50] Cost = [1,1,1] budget = 20 Binary search solution will return 5 because it will choose 1st machine and will make 5 alloys that will cost around (5*2) = 10 and our stocks array will be [0,0,0] and budget will become (20-10) = 10. Still using this 10 we can make one alloy using another machine (5+2+2). Please rectify me if I am wrong.
@saujanyasolanki4242
@saujanyasolanki4242 Жыл бұрын
If you read the description carefully you will see there is a highlighted line in question that tells 'All alloys must be created with same machine' so we cannot use the remaining budget on another machine
@DreamFist
@DreamFist Жыл бұрын
ans=max(ans,res) in maxNumberOfAlloys is not needed ,as we are always incrementing l whenever we find a satisfying budget hence always increasing nature.Please correct me if i am wrong.
@anubhavnegi4230
@anubhavnegi4230 Жыл бұрын
nope res might be incrementing for a particular value in composition while we carry out the binary search but it might change for the next value in composition as we might get a lesser value of res the the previous one so ans is required
@ishankrajpal8231
@ishankrajpal8231 Жыл бұрын
tech wiser huh
🔴 2860. Happy Students II Weekly Contest 363 II Leetcode 2860
11:16
Каха и лужа  #непосредственнокаха
00:15
За кого болели?😂
00:18
МЯТНАЯ ФАНТА
Рет қаралды 3 МЛН
快乐总是短暂的!😂 #搞笑夫妻 #爱美食爱生活 #搞笑达人
00:14
朱大帅and依美姐
Рет қаралды 12 МЛН
Dynamic Programming isn't too hard. You just don't know what it is.
22:31
DecodingIntuition
Рет қаралды 197 М.
2355. Maximum Number of Books You Can Take (Leetcode Hard)
18:59
Angshuman Bhowmik
Рет қаралды 3,7 М.
The Unfair Way I Got Good At LeetCode
23:02
Aman Manazir
Рет қаралды 98 М.
Top 7 Algorithms for Coding Interviews Explained SIMPLY
21:22
Codebagel
Рет қаралды 442 М.
Bresenham's Line Algorithm - Demystified Step by Step
16:10
NoBS Code
Рет қаралды 62 М.
I Solved 1583 Leetcode Questions  Here's What I Learned
20:37
ThePrimeTime
Рет қаралды 736 М.
Pass the Pillow || Maths & Logic || Leetcode-2582
10:17
Aryan Mittal
Рет қаралды 4,3 М.
Каха и лужа  #непосредственнокаха
00:15