the catch that at the second condition we only have to assign sum = arr[i]+arr[j]+arr[k], without doing any k-- or j++ had me going. Thank you so much :)
why we are not skipping duplicate and calculating everytime for duplicate,we can use // while (second < third and ar[second] == ar[second + 1]){ // second++; // } but this is not working Don't know why please reply
to find the minimum between two values , one should be bigger , but for the first element , there is no second valuw to compare , so we take maximum integer possible .
the catch that at the second condition we only have to assign sum = arr[i]+arr[j]+arr[k], without doing any k-- or j++ had me going.
Thank you so much :)
//Same Explanation with different Solution
Arrays.sort(nums);
int n=nums.length;
int closeSum = nums[0]+ nums[1]+nums[n-1];
for(int i=0;i
You made this problem so easy to understand. Thanxxx!!
U explain so nicely and concrete i jst love ur video please make more such video
Hey! how many problems have you solved on leetcode so far?
We can use three pointers right for optimum solution
Thankyou mam very nice and beautiful explanation can you please make video how to approch leetcode as begginer
Nice and simpler explanation!
Great Explanation
ye kitti osm hai yaar 🥰
Tum n aise hi kisi ke bhi comment ko like mat karte jao,
Hame hope mil jati hai 🫣
@@rohitthakre215 😂
plg view full code after submitting and code typing time view max screen or possible to press f11 to full window.
why we are not skipping duplicate and calculating everytime for duplicate,we can use
// while (second < third and ar[second] == ar[second + 1]){
// second++;
// }
but this is not working Don't know why
please reply
somw time u r best
Thanks for this nice explanation
Is this the best time complexity we can get?
amazing explanation
what if i store the elements one by one in new array of size three and by sorting them i can find the sum closest to target ?
It would be much better if you could write a cleaner code, it is not just about getting the code submitted.
why we done minus target
to fing the difference, or to find which is closest ..to find the distance
Please make video on suduko solver and valid sudoko 🙏🙏🙏🙏
Hey Shruti, thanks for asking, Sudoku solver video is already made:
th-cam.com/video/eLhmZlsGmvE/w-d-xo.html
nice
thanks a lot
Thanks a lot maam :)
why abs() is used? also why int start =num[i+1] rather than 0?please explain
abs is absolute value ...if diff is -ve it will consider in +ve only
why diff = INT_MAX ?
to find the minimum between two values , one should be bigger , but for the first element , there is no second valuw to compare , so we take maximum integer possible .
@@shivamnegi7552 thank you vro
@@techieworld4269 love you
Good explanation. But your intendations are pretty weird !!!
difficult to understand from this
what is this test case failing can someone help?
test case - [1,1,1,0] , target =-100
my code->
int diff=INT_MAX;
for(int i=0;i