Maximum Sum Triplet
Vložit
- čas přidán 27. 09. 2021
- Problem Description
Given an array A containing N integers.
You need to find the maximum sum of triplet ( Ai + Aj + Ak ) such that i LESS THAN j LESS THAN k and Ai LESS THAN Aj LESS THAN Ak.
If no such triplet exist return 0.
You are easily one of the best teachers I have ever come across online/offline. This was IMMENSELY helpful! Please cover all programming questions on InterviewBit because your in-depth explanations are of great help. Just a suggestion (i know it doesn't matter much though): if(i==n-1) will be checked for all n iterations of the first for loop. So, instead of that if condition inside the loop, you could have written right[n-1]=A[n-1] before the first for loop. Again, please cover all questions. It's immensely useful for me. Thank you for helping me out
Thank you Bhavesh, yes writing suffix array with the right[n-1] initialized before is better, and yes, I will try to cover all the questions from InterviewBit
jyada hogya bhai
@@divyangdheer7292 hmmm... Abhi mujhe bhi aisa lag raha hai. Par comment rehne deta hoon
Whenever I am stucking on problem coming on youtube & searching for your solution video
Amazing solutions.
great video and to the point, great explanation, thank you for the video
Great work . Very helpful content
mam i love to watch your explaination ...great teaching.Thank you
got the intuition by my own, just couldnt implement it, Once again beautiful explanation
How did you build the intuition on your own?? I couldn't even think of it 😢
I'm not able to build intuition to any question from my scratch. Always have to look for video. Can you suggest some tips pls
great explanation mam good, hoping to expect more videos on leetcode questions haven't seen with good visual with step-by-step approach
really helpful, thank you very much di🙏🙏🙏
nice explaination mam! thank you
amazing explanation :)
Thanks for the great explanation
I was not able to understand 100% but got the idea thanks
The girl behind her is like sone do yrr 🤣🤣
I noticed that as well😂😂
Thanks a lot 🙌🏻
thankyou so much di🙏🙏
there are various explanation of every problem in youtube but i like you and your video 😁
btw
Nice explanation 👌👌
I too😀 like u and your videos
But this code doesn't work for -ve numbers array isn't it???????
why cant we sort the whole array and calculate sum -of last 3 index?
great video, but i have a question here , if we are taking just smaller on the left of the current element while traversing the main array , then we are making the suffix array, if for left we are taking the lower bond, shouldn't for the right largest we should be taking the upper bound.
or we are taking the right most greatest element in the form of suffix array , why are not doing the prefix array as well for the left side also.
any reasons would be appreaciated.
thanks.
For a element, we want to find greatest element on right side, hence we are taking suffix array…
But it’s not the same case for finding element from left side..
Here ,we are not searching for smallest element on the left side, but we are searching for greatest element on left side which is less than element .
Hence using suffix array will not work for left side
Also if you take suffix array for left side..it may give element which is more than the middle element… this will violate the constraints given in the problem..
Constraint:- Ai
Apka laptop ka ram kithna hoga.
Ye tabs enthe kule he😂.
Ryzen ka he kya or Intel i5 11gen.
someone is there in your background :)
great explanation mam
kindly provide code as well which u explain in video , it will be helpful for us.
Ma'am why you not solving potd daily,we daily waiting your video
👍👌
woah...
we can do it in O(n ) by sorting array and fetching last three elements sum as answer?
no
@@dakshdolka800 yes I know it will be not accepted !
how to contact you
probabilityisfun63@gmail.com
@@probabilitycodingisfunis1 🤣