Тёмный

Kadane's Algo in 16 minutes || Algorithms for Placements 

CodeHelp - by Babbar
Подписаться 627 тыс.
Просмотров 192 тыс.
50% 1

In this Video, we are going to learn about Kadane's Algorithm.
There is a lot to learn, Keep in mind “ Mnn bhot karega k chor yrr apne se nahi hoga ya maza nahi aara, Just ask 1 question “ Why I started ? “
[For 20% Discount ] Visit Coding Ninjas: bit.ly/3cfdKTe
Discord Server Link: / discord
Course Flow: whimsical.com/...
Slides Link: drive.google.c...
Code Links: github.com/lov...
Questions Links:
- Kadane's Algo - leetcode.com/p...
Do provide you feedback in the comments, we are going to make it best collectively.
Connect with me here:
Instagram: / lovebabbar1
Twitter: / lovebabbar3
Telegram Group Link: Love Babbar CODE HELP
telegram.me/lo...
My Editor: www.instagram....
Intro Sequence: We have bought all the required Licenses of the Audio, Video & Animation used.
#DP_Series #LoveBabbar

Опубликовано:

 

16 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 229   
@cptshr
@cptshr Год назад
This was an amazing example sir, if we wanted we would have made this code a lot more heavier and complex. Increasing its complexity. But your video showed us an follow process to make the code optimal and reduce the complexity to lowest possible.
@odiacomdeyu.s3148
@odiacomdeyu.s3148 Год назад
When you study great teachers… you will learn much more from their caring and hard work than from their style. TQ sir
@RajeshSharmaIndia
@RajeshSharmaIndia Год назад
i just came to your video , i am afraid about DSA , Now i just see that video and now i am confident that i can also solve the problems, your way of teaching is quite simple and easy. thanks a lot.
@Caroline-up8qw
@Caroline-up8qw Год назад
Nooooo one can explain better than him...Thank you Sir for such an easy explanation
@khemendrabhardwaj2552
@khemendrabhardwaj2552 Год назад
Even if we are asked for size of longest subarray which yields the max sum , we can use Concept of Variable size window to find the sum(mx sum using kadane ) . Time => O(n)
@Asad-pq7el
@Asad-pq7el Год назад
bhai 2 loop use karke all subarray kaise nikal sakte hai?
@discarded1669
@discarded1669 Год назад
@@Asad-pq7el take a vector sum and intial array of size n, then go i = 0->n, where there's a var x = 0 & max = 0 then run j = i -> n, where x += arr[j] and if arr[j] beginner than max update it and also store the i & j index in another var a,b.. after the whole iteration is completed, you'll have a, b which is the starting & finishing index of the longest subarray with max sum..
@francksgenlecroyant
@francksgenlecroyant 11 месяцев назад
so nice to see someone who can explain things just as easy as this, I understood everything concept he explained while I can speak nor hear a single word in indian language, imagine if he were speaking in English 🤣🤣, a great teacher always finds a way to make students understands what he means. Thanks India for producing such indian talents.
@maheshbk-dh1co
@maheshbk-dh1co Год назад
You are going to revolutnize the coding universe....💯💯 love from nepal..🥰
@kashyapit
@kashyapit Год назад
The also doesn't work for negative numbers, You need different algorithm. Following is the working implementation in Javascript: function maxSubArray(nums) { let maxSoFar = nums[0]; let maxEndingHere = nums[0]; for (let i = 1; i < nums.length; i++) { maxEndingHere = Math.max(nums[i], maxEndingHere + nums[i]); maxSoFar = Math.max(maxSoFar, maxEndingHere); } return maxSoFar; }
@Cas7nova
@Cas7nova Год назад
The playlist that I've been searching all over the internet and finally you started it.., thankyou for making it❣️
@KaushikSharma-c3q
@KaushikSharma-c3q Год назад
One of the most important approach for the complex problem of array.
@amarpreetkaur6056
@amarpreetkaur6056 Год назад
Bhaiya, A suggestion for Dsa series-- Could you please create a schedule kinda like when to start when to end what , An excel sheet or something where we can enter our start date nd the rest dates will b decided logically for whole dsa plan ,this will give us a fair idea of which vdo/homework/tasks should take what time for completion. We can stick to that and try to complete the course within the deadlines as mentioned in the sheet. Problem in self is that we don't get an idea how much to do each day or how to allocate number of days to each topic,thus we exaggerate the things without proper plan leading to non completion of tasks
@ankitadodamani8397
@ankitadodamani8397 Год назад
i agree!!
@uzerkhan1758
@uzerkhan1758 Год назад
Bhaiyya ,love the video and solution, Please upload the lecture on- "sliding windows algorithm"
@riteshko123
@riteshko123 Месяц назад
Some Nigaa Said "This was an amazing example sir, if we wanted we would have made this code a lot more heavier and complex. Increasing its complexity. But your video showed us an follow process to make the code optimal and reduce the complexity to lowest possible."
@appajik858
@appajik858 3 месяца назад
explained from basics, so best explanation ever thank uuuu😇
@ChutHunter
@ChutHunter Год назад
Simplest and BEST explaination ever! Thank you so much babbar bhaiya.
@vivekvatsalya8836
@vivekvatsalya8836 Год назад
Thank you bhaiya ....just isko sikhne ke bad maine lagatar 2 questions solve kar di with some modifications for different problems
@iteself_me
@iteself_me Год назад
170 Bhaiya aapke ecplainations ki etni aadat hui hai ki ab baki khi se bhi padho kuch samj nahi aata Besttesstttt explaination & Bhaiyaaaa Everrrr😍
@surajmendhe2594
@surajmendhe2594 Год назад
Thank you so much sir nice explanation and easy to understand ❤️
@dikshantmalusareh1458
@dikshantmalusareh1458 Год назад
Another game changing playlist started...kudos to you sir...DAY 1 ✅
@anirudhjain7598
@anirudhjain7598 Год назад
KMP Algorithm next pls??🙃
@AbhishekGupta-vu7xd
@AbhishekGupta-vu7xd Год назад
Han bhaiya kmp algorithm please upload the video
@Krish_Nambyal_Bisht169
@Krish_Nambyal_Bisht169 5 месяцев назад
thankyou bhaiya for easy and to the point concept of kadane's algo.
@softwareengineering101
@softwareengineering101 Год назад
I have gone through multiple videos none of them helped me to understand Kandane's algorithm. This video does
@prashusahu6610
@prashusahu6610 Год назад
Thank You Bhaiya for Completing the Remaining Algorithms
@sirkartik
@sirkartik Год назад
Thankyou bhaiya, I understood it clearly now...😄 I wanted to ask that will us be ever able to actually make these kind of algorithms ourseleves? Like learning sliding windows, kadane's algo and other algos is different thing and making them is different.
@rohanverma3111
@rohanverma3111 Год назад
To actually make algorithms you can do your research/phd in algorithms. These algorithms were made in budding days of computer science and algos are mainly build by mathematicians. Like this kadane algo was made in 1980s
@sirkartik
@sirkartik Год назад
@@rohanverma3111 Thanks for the info brother👍
@sirkartik
@sirkartik Год назад
@@rohanverma3111 I want to ask that do developers make algorithms or they just see it from somewhere, or learn it and only implement it?
@rohanverma3111
@rohanverma3111 Год назад
@@sirkartik I hardly believe that any developer is building some amazing algorithms in their day to day job. No dev will write a new algo. Even if you make a decent algorithm in a project codebase on your own but it won't be approved by your seniors if some standard algo is out there. If you are interested about making algorithms you can opt for MS/PHD in CSE and can take your thesis as Algorithms. To discover new things you need to pursue research.
@neerkhandor5007
@neerkhandor5007 Год назад
Bhaiya if possible can you start series on solving your 450 Dsa cracker sheet If you provide a bit overview of the problem also then it will be very much helpful as your explanation is excellent Thank you bhaiya 🙏
@saujanyashukla5483
@saujanyashukla5483 Год назад
Yeah it's needed
@adityasrivastava4082
@adityasrivastava4082 Год назад
Yes , it will be helpful.
@vinaykumaryadav8718
@vinaykumaryadav8718 Год назад
Wonderful explanation.... did't know that. it is that much easy.
@hehejoker2059
@hehejoker2059 10 месяцев назад
Nice Man just opened my concepts crystal clear
@Anjali-bw9hd
@Anjali-bw9hd 7 месяцев назад
doesnt work if all numbers in array are -ve, maxi will return a negative integer rather than returning 0.
@kritikaagarwal810
@kritikaagarwal810 4 месяца назад
Simply great explanation, great bhaiya 🔥🔥🙌🙌
@manojtate9604
@manojtate9604 10 часов назад
top notch explanation !
@ayusheditz8300
@ayusheditz8300 Год назад
Efforts >>>3 man ❤️
@avibirla9863
@avibirla9863 Год назад
Hello Jiii ...web development course kabhi upload honge bhaiya ?Excited to learn web development from ur end...
@AbhishekGupta-vu7xd
@AbhishekGupta-vu7xd Год назад
Ek baar mein hi samjh aa gaya thanks mahan guru ji 😊
@prateekjain262
@prateekjain262 3 месяца назад
third step needs more explanation why we need to make sum 0 if sum becomes -ve anuj bhaiya have explained it well if some one does not understand please checkout his video once.
@siddharthsinghaniya3177
@siddharthsinghaniya3177 Год назад
if all the element in the array is -ve then apply this long long maxSubarraySum(int arr[], int n){ long long max = arr[0]; long long sum=0; for(int i=0;imax) max = sum; if(sum
@its_sagar371
@its_sagar371 15 дней назад
Best Explanation bhaiya
@AKSHAYKUMAR-ht1tl
@AKSHAYKUMAR-ht1tl 2 месяца назад
majaa aa gyaa bro. keep it up!!
@revolverlim.6444
@revolverlim.6444 5 месяцев назад
mst samjaya bhaiya
@truptigaikwad7515
@truptigaikwad7515 21 день назад
Thanks I was stuck at this program from last 3 days,sab ho gya tha sum
@Vishal_84_k
@Vishal_84_k Год назад
bhoat time se wait kr Raha tha ..
@thirdcreater4231
@thirdcreater4231 Год назад
Bhaiya plz make videos on rabin karp algo and kmp algo
@BornHubisLive
@BornHubisLive Год назад
Thankuu bro... For your efforts..❤🙏
@Josuke217
@Josuke217 5 месяцев назад
Amazing explanantion.
@prathamjoshi3969
@prathamjoshi3969 Год назад
truly the best explaination
@MihikaChhabra-t4z
@MihikaChhabra-t4z 9 месяцев назад
I understood the approach, thanks bhaiya but I am not understanding why this one is not working, I understand that this is not the efficient approach but yet, what I am doing wrong class Solution(object): def maxSubArray(self, nums): """ :type nums: List[int] :rtype: int """ n=len(nums) self.maxSum=-float('inf') if n==0: return 0 if n==1: return nums[0] def helper(nums,i,curr_sum): if i>n-1: self.maxSum=max(self.maxSum,curr_sum) return curr_sum op1=helper(nums,i+1,curr_sum+nums[i]) op2=helper(nums,i+1,nums[i]) self.maxSum=max(op1,op2) return max(op1,op2) helper(nums,0,0) return self.maxSum
@mdyusufansari8897
@mdyusufansari8897 4 месяца назад
is this correct ? python arr = [-1,2, 2, -3,4, -4, 5] max = 0 current = 0 for i in arr: current += i if current < 0 : current = 0 if current > max : max = current print(max) print(current)
@abknand579
@abknand579 9 месяцев назад
You found the sum but which sub array produced that highest sum was not shown in code. How do we highlight which sub array has the highest sum?
@soumadipmajila7962
@soumadipmajila7962 Год назад
Any upcoming live web development batches? Your RU-vid content has been super helpful, but I want to try a live class for a more interactive learning experience. Let me know if you have any plans or updates. Thanks!
@piyushs1511
@piyushs1511 Год назад
Bhaiya swad aa jaata haii apki video dekh k❤💯
@yashjain5412
@yashjain5412 Год назад
if we consider all +ve integer in array then max sum should be 12
@ashoksolanki7895
@ashoksolanki7895 Год назад
most valuble content bhaiya majaa aa gya 😀😀
@rahulchavda9063
@rahulchavda9063 Год назад
understood the concept thank you babbar bhai
@yashendrabadal4776
@yashendrabadal4776 Год назад
thanks bhaiya you made dsa easy for me
@ekanshsharma1309
@ekanshsharma1309 Год назад
Thank you so much bhaiya😁❤️ So much love to you
@kashyapit
@kashyapit Год назад
Doesn't work on all negative numbers. I have to search correct Kadane's also.
@tejaswijadhav8031
@tejaswijadhav8031 Год назад
Amazing Explanation Sir
@pradeepkumarsharma52
@pradeepkumarsharma52 Год назад
Kudos to your hardwork 👏
@kumarpawansahh
@kumarpawansahh Год назад
Ye bari achi initiative liya hai aapne bhaiya 👍👍
@knowledgedoctor3849
@knowledgedoctor3849 Год назад
Sliding Window Playlist is Missing, Better Add Some Video Regarding Problem Solving About Sliding Window... Unacademy Live Session Me Maja Nehi Aiya😔 Pls Babbar Bhai Last Wala Topic Cover Kar Dho.. Love From Bangladesh
@depelterturbo
@depelterturbo Год назад
Try coming to this side by illegal border crossing...
@anishkhari4900
@anishkhari4900 9 месяцев назад
If all the elements are negative then the max sum of contiguous subarray is not zero.
@dheerajsharma355
@dheerajsharma355 Год назад
good explanation.....How all are here after todays daily challenges at leetcode lol?
@cruzer_blade.
@cruzer_blade. 7 месяцев назад
thank you sir
@abhijeetbasfore6816
@abhijeetbasfore6816 Год назад
String algorithm , segment tree krwa do
@rishikeshsarangi1245
@rishikeshsarangi1245 Год назад
great explanation! thank you for this
@twaritagrawal1232
@twaritagrawal1232 Год назад
thankyou sir
@ManishYadav-dt2qc
@ManishYadav-dt2qc Год назад
Achha lga app ka btane ka trika ♥️
@sarabjeetsingh297
@sarabjeetsingh297 8 месяцев назад
sir mazza aa gya 😊
@ahsanahmad8600
@ahsanahmad8600 Год назад
Nice explanation sir ......
@rudreshkarn2155
@rudreshkarn2155 Год назад
@CodeHelp Although all the test cases passed. I don't think this code should pass the case where all the Elements are negative.
@Smitiraiv
@Smitiraiv Год назад
It would because the sum
@MakeuPerfect
@MakeuPerfect Год назад
Bhaiya sliding window ka ak video lao
@sujalstark580
@sujalstark580 5 месяцев назад
Algo samjha diya apne code khud karunga😂
@deepakchaurasia6952
@deepakchaurasia6952 3 месяца назад
why are you taking sum =0 if sum
@TON-108
@TON-108 Год назад
You made it easy thank you 😌
@namratakaushik22
@namratakaushik22 Год назад
nice explanation
@mohammedinam4324
@mohammedinam4324 Год назад
Best Explanation
@anupamojha9343
@anupamojha9343 Год назад
Bhaiya please two pointer approach and sliding window algo ko bhi cover kr do
@BongoLasss
@BongoLasss Год назад
Sir , What if all the elements were negative....so in that case, how could we implement the condition for less than 0
@Griffith_1802
@Griffith_1802 Год назад
did you get the answer ?
@johnysins69696
@johnysins69696 Год назад
@@Griffith_1802 some has mentioned this code: function maxSubArray(nums) { let maxSoFar = nums[0]; let maxEndingHere = nums[0]; for (let i = 1; i < nums.length; i++) { maxEndingHere = Math.max(nums[i], maxEndingHere + nums[i]); maxSoFar = Math.max(maxSoFar, maxEndingHere); } return maxSoFar; }
@abacuswithrehan264
@abacuswithrehan264 Год назад
I guess you need to check if all elements are negative then return smallest negative else run kadane's algo.
@r2editx
@r2editx 9 месяцев назад
thank you sir 👌👌👌👌
@ArunKumar-yg9st
@ArunKumar-yg9st Год назад
Bhaiya if all elements are negative then how we will treat this question Bhut achha pdhate hai bhaiya aap
@nikunjjain5212
@nikunjjain5212 Год назад
It is handled in the case where maxi =arr[0] Because Atlast we are simply returning maxi.
@sukhjitsingh959
@sukhjitsingh959 Год назад
Thanks for new vedio Babbar
@programmingwithvishnu2601
@programmingwithvishnu2601 Год назад
Great Explanation
@vedantraut256
@vedantraut256 Год назад
// COMPLETE CODE class Solution { public: int maxSubArray(vector& nums) { int sum = 0; int maxi = nums[0]; for(int i=0; i
@user-yh4rf9oc4g
@user-yh4rf9oc4g 3 месяца назад
Nice lecture
@d3vanshmemer
@d3vanshmemer Год назад
very easily described
@sahilanand30
@sahilanand30 Год назад
Best explanation Segtree wen?
@skibidubehindi
@skibidubehindi Год назад
Sir 1 web developer kee series bhi bna do jldi sbke liye helpful hogi
@fit_tubes_365
@fit_tubes_365 4 дня назад
Thanks
@vinayghadigaonkar8215
@vinayghadigaonkar8215 8 месяцев назад
Wa Bhai ❤
@royz-byabhinavraj7459
@royz-byabhinavraj7459 Год назад
But in the question it is asked to give the sub array too where is the sub array ?
@pankajpoonia6043
@pankajpoonia6043 Год назад
sir can you please make a video on fermat little theorem and wilson theorem 🙏🙏🙏🙏🙏
@NazareAlamOfficial
@NazareAlamOfficial Год назад
Please make a video on Tower 🗼 of Hanoi on recursion
@pallavi9362
@pallavi9362 Год назад
amazing explanation!!!!!!!!!
@stat_life
@stat_life Год назад
What if we dont need maximum sum but instead want those subpairs which make maximum sum???
@tanmoybiswas6048
@tanmoybiswas6048 10 месяцев назад
Thank you bhaiya
@ranitnaha9892
@ranitnaha9892 Год назад
If the array contains all negative integers than what will be the sum? since here u are excluding all the negative sum,,
@sakshiawadhiya7267
@sakshiawadhiya7267 Год назад
Prefix sum algorithm ki bhi video bnaeye
@modanwalpriti8769
@modanwalpriti8769 Год назад
Thankyou for this video bhiaya
@hafizsakib2734
@hafizsakib2734 Год назад
9:37 agar sum = -1 aya,then max(-1,-2) = -1; to hum kiu sum ko ignore kare jaab sum 0 se kam aye??
@ABHI-ez9hp
@ABHI-ez9hp Год назад
Kudos to your effort :)
@shubhamkondekar5382
@shubhamkondekar5382 Год назад
Waiting for long time, ab to placement pkki
Далее
LeetCode was HARD until I Learned these 15 Patterns
13:00
Kadane's Algorithm JavaScript
8:24
Просмотров 111
How to be a 10x Learner
17:41
Просмотров 87 тыс.
My Brain after 569 Leetcode Problems
7:50
Просмотров 2,6 млн