Candy | Live Coding with Explanation | Leetcode -135

  Рет қаралды 14,548

Algorithms Made Easy

Algorithms Made Easy

Күн бұрын

Get Discount on GeeksforGeeks courses (practice.geeks...) by using coupon code: ALGOMADEASY
To support us you can donate
UPI: algorithmsmadeeasy@icici
Paypal: paypal.me/algorithmsmadeeasy
Check out our other popular playlists:
Questions you might like:
✅✅✅[ Tree Data Structure] : • Tree Data Structure
✅✅✅[ Graphs Data Structure] : • Graph Data Structure
✅✅✅[ February Leetcoding Challenge] : • February Leetcoding Ch...
✅✅✅[ January Leetcoding Challenge] : • January Leetcoding Cha...
✅✅✅[ February Leetcoding Challenge] : • February Leetcoding Ch...
✅✅✅[ March Leetcoding Challenge] : • March Leetcoding Chall...
✅✅✅[ December Leetcoding Challenge] : • December Leetcoding Ch...
✅✅✅[ November Leetcoding Challenge] : • November Leetcoding Ch...
✅✅✅[ August Leetcoding Challenge] : • August LeetCoding Chal...
✅✅✅[ July Leetcoding challenges] : • July LeetCoding Challe...
✅✅✅[ June Leetcoding challenges] : www.youtube.co...
✅✅✅[ May Leetcoding challenges] : • May LeetCoding Challen...
✅✅✅ Cracking the Coding Interview - Unique String: • Cracking the Coding In...
Problem Link: leetcode.com/p...
Code: github.com/Alg...
If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful.
#coding #leetcode #programminglife #programmingisfun #programmer #tech #software #codinglife #leetcode

Пікірлер: 32
@AlgorithmsMadeEasy
@AlgorithmsMadeEasy 3 жыл бұрын
We hope you all are enjoying our videos!!! Don't forget to leave a comment!!! Please like the video to support us!!! Questions you might like: ✅✅✅[ Tree Data Structure] : kzbin.info/aero/PLJtzaiEpVo2zx-rCqLMmcFEpZw1UpGWls ✅✅✅[ Graphs Data Structure] : kzbin.info/aero/PLJtzaiEpVo2xg89cZzZCHqX03a1Vb6w7C ✅✅✅[ January 2021 Leetcoding Challenge] : kzbin.info/aero/PLJtzaiEpVo2wCalBcRcNjXQ0C6ku3dRkn ✅✅✅[ February 2021 Leetcoding Challenge] : kzbin.info/aero/PLJtzaiEpVo2wrfvII0eZQsPm-MZCmHodm ✅✅✅[ March 2021 Leetcoding Challenge] : kzbin.info/aero/PLJtzaiEpVo2zH-YC5ZiptbAvw2QZkmyk9 ✅✅✅[ April 2021 Leetcoding Challenge] :kzbin.info/aero/PLJtzaiEpVo2z9PpcJcsl5j3RXutiTU-GB ✅✅✅[ December 2020 Leetcoding Challenge] : kzbin.info/aero/PLJtzaiEpVo2xo8OdPZxrpybGR8FmzZpCA ✅✅✅[ November 2020 Leetcoding Challenge] : kzbin.info/aero/PLJtzaiEpVo2yMYz5RPH6pfB0wNnwWsK7e ✅✅✅[ August 2020 Leetcoding Challenge] : kzbin.info/aero/PLJtzaiEpVo2xu4h0gYQzvOMboclK_pZMe ✅✅✅[ July 2020 Leetcoding challenges] : kzbin.info/aero/PLJtzaiEpVo2wrUwkvexbC-vbUqVIy7qC- ✅✅✅[ June 2020 Leetcoding challenges] : kzbin.info/aero/PLJtzaiEpVo2xIPptnCvUtKrUcod2zAKG ✅✅✅[ May 2020 Leetcoding challenges] : kzbin.info/aero/PLJtzaiEpVo2wRmUCq96zsUwOVD6p66K9e ✅✅✅ Cracking the Coding Interview - Unique String: kzbin.info/aero/PLJtzaiEpVo2xXf4LZb3y_BopOnLC1L4mE Struggling in a question?? Leave in a comment and we will make a video!!!🙂🙂🙂
@mr.streetwear506
@mr.streetwear506 3 жыл бұрын
Thank you so much for the second approach, I was not able to grab it but after this video its crystal clear.
@aswathis5902
@aswathis5902 3 ай бұрын
I actually fed up by not understanding the approach of left and right but unexpectedly i came across your video and now i got the idea 😻 its really helpful tqsm bro❤
@strawberriesandcream2863
@strawberriesandcream2863 Жыл бұрын
was looking for a video explanation of the slope approach. thanks!!
@atifhu
@atifhu 2 жыл бұрын
No doubt the explanation was great, but it feels like you explained just the pattern for this question but not the inutition behind it, how and why this is greedy, and why we are getting answer. Though I appreciate for all the efforts.
@AlgorithmsMadeEasy
@AlgorithmsMadeEasy Жыл бұрын
Good point. We will try not to repeat that in future videos.
@ragingpahadi
@ragingpahadi 3 жыл бұрын
Mountain Solution Explanation is Ultimate ! Aap ko koti koti pranam : ]
@AlgorithmsMadeEasy
@AlgorithmsMadeEasy 3 жыл бұрын
Thanks !!
@praveenj3112
@praveenj3112 3 жыл бұрын
Glad to know that second approach . Thank you so much
@AlgorithmsMadeEasy
@AlgorithmsMadeEasy 3 жыл бұрын
Happy to help!!
@rupakkorde
@rupakkorde 3 жыл бұрын
Mountain solution is awesome Thanks a lot for covering it.
@AlgorithmsMadeEasy
@AlgorithmsMadeEasy 3 жыл бұрын
Thanks !!
@madanmohanpachouly6135
@madanmohanpachouly6135 2 жыл бұрын
​@@AlgorithmsMadeEasy How to come up with mountain intuition in Interview , if not seen the problem before :-(.
@piyush814
@piyush814 3 жыл бұрын
I didn't understand the 2nd solution clearly. But thanks for explaining. Others are just explaining the 1st solution only
@sufyan2317
@sufyan2317 2 жыл бұрын
Graph approach clearly explained here.
@rajvidesai3352
@rajvidesai3352 2 жыл бұрын
Best explanation, I just loved it !
@pramodhk2702
@pramodhk2702 2 жыл бұрын
Ma'am could you pls explain the intuition behind the second approach? Great explanation though. Thanks
@riamonga2283
@riamonga2283 2 жыл бұрын
How do we get the intuition for the second approach and THE FORMULA used in it? Great content tho! Thank you 🙌🙌🔥
@PeterParker-tp6gm
@PeterParker-tp6gm 9 ай бұрын
Perfect explanation 🔥🔥⚡️
@tianzhengmai1369
@tianzhengmai1369 Жыл бұрын
Sorry, could you explain the logic of the equation "candies = sum(up) + sum(down) + Max(up, down)"
@andressalazargaleano6419
@andressalazargaleano6419 3 жыл бұрын
great explaination
@AlgorithmsMadeEasy
@AlgorithmsMadeEasy 3 жыл бұрын
Thanks !!
@nishantgarg2815
@nishantgarg2815 2 жыл бұрын
why is Max(up, down) added ?
@shubhamlahoti9758
@shubhamlahoti9758 3 жыл бұрын
Why are we adding 1 in the second last line?
@AlgorithmsMadeEasy
@AlgorithmsMadeEasy 3 жыл бұрын
Because we need the data for the last mountain without skipping any point. So we take the sum of 1 to n for up and down slopes plus we add the peak which is going to be 1 greater than the point given to the max(up, down) Sum(up) + sum(down) + peak Where, peak is max(up,down) + 1 In the part inside the loop, we skip the last point of the valley so we subtract 1 from the outer formula that cancels out the +1. And we get the inner loop formula. Sum(up) + sum(down) + peak - 1 Where, peak is max(up,down) + 1 So the consolidated formula becomes Sum(up) + sum(down) + max(up, down) Hope this helps.
@shubhamlahoti9758
@shubhamlahoti9758 3 жыл бұрын
@@AlgorithmsMadeEasy Thank you so much for the detailed explanation! The implementation was quite tricky but you made it seem like a cakewalk :)
@AlgorithmsMadeEasy
@AlgorithmsMadeEasy 3 жыл бұрын
Happy to help !!
@rhythmbhatia8906
@rhythmbhatia8906 2 жыл бұрын
@@AlgorithmsMadeEasy Please try to explain the formula in the video itself! If we have to read text, then we would have visited the Discuss section itself!
@pranavsharma7361
@pranavsharma7361 2 жыл бұрын
What about slope like /\
@chaitanyakrishna7750
@chaitanyakrishna7750 3 жыл бұрын
I know the java basics For understanding this program What I need to learn first 🥇 Anyone pls 🙏 I didn't understanding time complexity and space complexity what it is? and more dp[].. So pls suggest to learn.. ☺
@AlgorithmsMadeEasy
@AlgorithmsMadeEasy 3 жыл бұрын
The first chapter in any DSA book is always on Complexity Analysis. Start with that. You can refer to the sequence in book DSA made Easy By Narsimha Karumanchi or from Cracking the coding interview.
@venkatasriharsha4227
@venkatasriharsha4227 3 жыл бұрын
My suggestion is to get strong with basics and then understand time and space complexities. Solve array and loop based problems to get better logically then start with recursions, DSA and DP problems. Practice solving in leetcode and hackerrank. Hope this helps :D Happy learning
Gas Station | Live Coding with Explanation | Leetcode - 134
13:56
Algorithms Made Easy
Рет қаралды 17 М.
КОГДА К БАТЕ ПРИШЕЛ ДРУГ😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 6 МЛН
World’s strongest WOMAN vs regular GIRLS
00:56
A4
Рет қаралды 12 МЛН
HELP!!!
00:46
Natan por Aí
Рет қаралды 34 МЛН
Binary Tree Cameras | Live Coding with Explanation | Leetcode - 968
13:15
Algorithms Made Easy
Рет қаралды 10 М.
My Brain after 569 Leetcode Problems
7:50
NeetCode
Рет қаралды 2,7 МЛН
Candy - Leetcode 135 - Python
13:45
NeetCodeIO
Рет қаралды 32 М.
Leetcode 135 - Candy - O(N)/O(1) Solution Explained
5:05
Teaspoon AI
Рет қаралды 982
Course Schedule III | Live Coding with Explanation | Leetcode - 630
13:38
Algorithms Made Easy
Рет қаралды 10 М.
Largest Rectangle in Histogram | Live Coding with Explanation | Leetcode - 84
12:51
Leetcode 135(Hard) Candy : Simple C++ Solution
10:26
Shivam Patel
Рет қаралды 1,4 М.
КОГДА К БАТЕ ПРИШЕЛ ДРУГ😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 6 МЛН