Hi Raj, Hriday here...I have been following your SDE sheet for a while, and I'm ecstatic to share that I've been offered an SDE intern position at Arcesium in my second year of Engineering, All thanks to youuuu !!!!
@@VarshaSingh-hi2sb true i am also facing the same problem i found a possible solution instead of returning high or low start off by saving your mid index in a ans variable and return it then you can understand if its the low that we are returning or the right
Once you explained the logic I wrote the code all by myself for both brute and optimal it's because of your lecture my cognitive skill is increasing thanks a lot❤❤❤ I
The way you got us to think why Binary Search -> was great !!! ...and this is actually what is to be taught in problem solving sessions. thank You very much Striver
do you go on just watching these videos without looking at the question first by yourself or do u first look at the question yourself and then watch this video?
Respect++ for Raj bhaiya!! If i was not learning dsa in such a constructive way idk where would i have been!! I solved this question by my own all thanks to you for creating this playlist and i am following your AtoZ sheet its amazing!!! Thanks 🌟🌟🌟🌟✨✨
17:30 There is a mistake in condition as (cntStud == m) will be true in this testcase but let pages[] = {25, 46, 28, 43, 50}. In this upto 70 pages, 5 students will be returned from second function but the moment 71 is checked no of student required will reduce to 3 as (25+46), (28+43), (50). And condition cntStud == m will reject it. Note that 71 is the maximum pages a student is allowed to take, so i can distribute (25+46), (28), (43), (50) to 4 students. Thus condition should be (cntStud
but bro book with 28 pages and 43 pages will be allocated to 2nd person only as maxlimit of pages is 71 how you distributed in 4 persons can you explain ?
@@dipingrover1970 71 is the "maximum limit" a student can hold. As number of students increase it becomes even more easy to distribute so that each of them is having lesser pages than the max limit. If I have 4 students, i can distribute in this way : (25+46) (28) (43) (50).
@@dipingrover1970 its simple lets take for eg arr=[1,2,3,4,7] and m=4 but acc to our algo 1st student will take 1+2+3 =6 pages then second will take 4 and 3rd will take 7 and we will never reach cnt of students==m==4 therefore condition should be cntstun return -1
Thank you very much sir. I've Been stuck on this problem from the last 3-4 days,watched a lot of videos but your explanation is just on some different level.
Please don't change problem links of A-Z dsa sheet frequently recently all gfg link got replaced with code studio links. It breaks the flow for those who are already preparing from the sheet. Instead of replacing existing links with new link you can add new section for code studio links @takeUforward
yes , you are right , i believe he is being sponsored by codestudio which is understandable but atleast we should get another set of problem on gfg alongside the others . I personally find that the gfg problems are a little more challenging and greater number of solutions are available , hence i choose gfg, what do u say?
Bhaiya I understand that you want to keep the course at a comfortable pace for better understanding, but i feel the frequencies of the videos should be increased as i think the course is moving too slow. Maybe its just me, but i thought that i would let you know. Thank you bhaiya for this amazing free course
No it is not that, it's just that lately I have a lot of office work, which does not leaves me with much time, I am just too exhausted, and apart from some topics, almost all are done, so I am going at my pace.
@@takeUforward bro linked list, string, stack, queue, heaps, bit manipulation these are the topics left, if not all the problems but atleast solve few important problems of all the topics.
@@takeUforward Please don't change problem links of A-Z dsa sheet frequently recently all gfg link got replaced with code studio links. It breaks the flow for those who are already preparing from the sheet. Instead of replacing existing links with new link you can add new section for code studio links
You saved my day, Striver bro. I was struggling without the Dry Run of the problem. This video solution is very helpful to understand everything like the approaches using Linear search, Binary Search, the Time Complexity, Dry Run, Intuition and Psuedo code. Thank you so much, bro.
I have a slight correction in the brute force solution. The countStudent returned from the helper function can be less than or equal to number of students(m) given. (cntstu
Try to minimize your range .Your Range is from 8 to 50 Now you can easily apply linear search on it , and at last your ans will be 16 @@AjithKumaR-jw9wt
@@harshitpatil6138 bro , i was also thinking the same . we should apply the binary search from lowest element to sum of array. but striver didn't recommend it.
@mhsunny123 Problem 1: Delivering packages (like in the shipping problem): You have a bunch of boxes (packages) to deliver. You have a truck with a certain weight limit (capacity). You can fit any number of boxes in the truck as long as the total weight doesn't go over the limit. Your goal is to find the smallest truck (capacity) that can deliver all the boxes in D days or less. Problem 2: Distributing books to students: You have a bunch of books to distribute to M students. Each student must get at least one book. You can't give half a book to a student, they need a whole one (contiguous block). Your goal is to find a way to distribute the books so that every student gets at least one book. Why the code checks differently: In the delivery problem: You're looking for the smallest truck that works. So, if you find a capacity that lets you deliver everything in D days or less, you know you can probably do even better with a smaller truck (hence checking numberOfDays
@@atharvameher5880 his videos are good for theoritical understanding but not upto the mark for problem solving , you will not be able to evolve to leetcode medium and end up loads of just easy questions also his playlist is incomplete since 2 years . Watch Pepcoding and Strivers videos they are the best , I am able to solve Leetcode Mediums after watching them
@@fettuccine794 hi please can u tell me how u r practicing problems have u taken any dsa course i am unable to solve the new problems kuch easy to ban jate lekin mideum nhi ban pate hai bahi koi tips ho bata ho apne experience se i am in third year
@@akworld2739 watch the Binary Search playlist by Striver and try to solve them on your own....you can pretty much ace that.....after than if you are doing Java watch Pepcoding videos....watch topics like Hashmaps , Heaps , Priority Queues , Stack , Queues , you will find many Leetcode Medium problems Doable....after that try to Master Recursion which is the most important topic....Pepcoding (Level 1 and Level2) are two of the best Recursion playlist in the internet.....along with Recursion side by side start learning the little Basics of Dynamic programming(just basics) like Memoization.....if you have done enough practice of Recursion , complete LinkedList and Trees....these two are easy topics and are just applications of Recursion....you will be able to solve many Medium problems of these topics.....After all these comes the most important part - Graphs and Dynamic Programming.....for these topic Striver is the best in the internet....better than any other free or paid courses , nobody can beat him....I believe that one should give minimum 3-4 months to Master these topics ....I am also doing DP right now Hope this answer helps you !!
Please don't change problem links of A-Z dsa sheet frequently recently all gfg link got replaced with code studio links. It breaks the flow for those who are already preparing from the sheet. Instead of replacing existing links with new link you can add new section for code studio links @takeUforward
This is similar to shipping belt question from BS playlist, i solved it and then came here. Your approach helps in solving other question also. Thank you bhaiya.
Striver bhai i didn't understand how the opposite polarity will work in this question? both sides were not possilbe in beginning even the high side then how can we decide in these situtations? ik you said high was kind of possible but i don't think that was clear enough for me. if you could elaborate on that part it would be helpful. Thank you for this series btw! You're doing god's work.
Hi, i have a question about part of the video with linear search. In that part if and only if helper function returns exactly same number as the number of students it will be satisfied, but if we check it for this test case: n = 4; m = 3; books = {24, 49, 24, 49}; The solution should be 73, but when the code gets to that point it will return 2, and so on... So 3 will never be returned; Based on this the array of returned values would look like 4, 4, ... 4, 2, 2, ... Did I miss something? Someone asked the same question, I gave the below answer So if its under, it means its possible. As you technically can go from 2 to 3 students by limiting some distribution, as you have no such barieer, but you cannot come back from 4 to 3. As you have a barrier :)
Bhai please put back the GFG links instead of Coding Ninja in A2Z DSA Please.... CN is very boring platform to get solve our doubt and also less support of community.
you know i used the logic of aggresive cows that you had taught in that video and solved this question using a boolean check function , and the runtime beat 100% i know its not that big of a deal haha kabi kabi tukka lag jata hai but it feels good 😄
Bro i am feeling a lot difficult in solving strings and heaps related problems could you please cover those as soon as possible... I know its difficult for you to manage but atleast can you tell me what i have to do to master these....
Hey.... if possible could you please create a video regarding like ... number of other rounds and type of questions asked in those rounds, in product based interviews based on your experience...if possible, it would be helpful. Thankyou
thank you for the wonderful explanation , i have a little doubt how we are assuring that low is equal to the sum of pages , becoz we are just changing it to mid+1 many times and mid is the average of high and low and there is no surety that mid+1 is equal to the sum elements of array
Linear Search Code gives wrong answer for the testcase N = 7, A[ ] = [15, 10, 19, 10, 5, 18, 7] M = 5. Output should be 25 but the code gives output as -1. Range is from 19 to 84. From 19 to 24, at 17:24 , cntStu returns 6 as student output. When pages(i) = 25, cntStu returns 4, and note that it can also return 5 as ans so 25 becomes our output but after return 6 from 19 to 24, at 25 cntStu returns 4 and m = 5 is never satisfied. This is my code below, class Solution { int cntPages(int A[], int pages,int sizeArray) { long long student = 1, capacity = A[0]; for(int i = 1; i < sizeArray; i++) { if(A[i] + capacity
hey striver please add the gfg links. I have solved many problems on gfg and suddenly it is removed from the A-Z SDE sheet. please give us a choice at least. now my progress is ruined.
I was wondering if we can use sliding window for this problem and simply iterate the window of size (no. of books-no. of students +1) tracking the minimum sum of the elements in the window...Can we use this approach ????
Striver: This is an extremely hard question ME: Just changed the lower and upper limit and modified the conditions of previous question and the question is solved. 😉😉. All Thanks to him though.
Hi Raj, This method doesn't works for this test case if the array is [35, 25, 20, 30, 60] and m( no. of students) = 4 because according to this code it says there is no answer possible. But practically there are 3 ways we can divide these books to 'm' students 35, 25 || 20 || 30 || 60 35 || 25,20 ||30 || 60 35 || 25 || 20, 30 || 60 Could you please explain
Hi raj , A small doubt. In the brute force approach , why did in the end when none of the possible values worked , we returned max_element of list and not -1. If max_element of list was a potential answer then it should have been taken care in the loop only.