Maximum Sum Triplet #InterviewBit Intuition+ Code + Example

preview_player
Показать описание
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

bhaveshkumar
Автор

Whenever I am stucking on problem coming on youtube & searching for your solution video
Amazing solutions.

adeshchhajed
Автор

got the intuition by my own, just couldnt implement it, Once again beautiful explanation

divy
Автор

great video and to the point, great explanation, thank you for the video

yashasvprajapati
Автор

mam i love to watch your explaination ...great teaching.Thank you

mohanavamsipidugu
Автор

I was not able to understand 100% but got the idea thanks

kapilpatel
Автор

But this code doesn't work for -ve numbers array isn't

KD-xiwu
Автор

why cant we sort the whole array and calculate sum -of last 3 index?

techworld
Автор

Can't this be solved better with prefix and suffix array in O(n) time ?

krupaharan
Автор

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.

sakshamsrivastava
Автор

really helpful, thank you very much di🙏🙏🙏

adityaverma
Автор

Apka laptop ka ram kithna hoga.
Ye tabs enthe kule he😂.
Ryzen ka he kya or Intel i5 11gen.

rajathkumar
Автор

The girl behind her is like sone do yrr 🤣🤣

anurag__pathak
Автор

great explanation mam good, hoping to expect more videos on leetcode questions haven't seen with good visual with step-by-step approach

bharathKumar-orgd
Автор

there are various explanation of every problem in youtube but i like you and your video 😁
btw
Nice explanation 👌👌

chandraprakashsahu
Автор

kindly provide code as well which u explain in video, it will be helpful for us.

devanshdixitmusicallyyours
Автор

someone is there in your background :)

basicGyaan
Автор

Ma'am why you not solving potd daily, we daily waiting your video

anuruddhtiwari
Автор

How to handle duplicates in this question 😢😢😢

priyadarshiroy
Автор

we can do it in O(n ) by sorting array and fetching last three elements sum as answer?

jigarjoshi