9
answers
1
watching
132
views
karthikg697Lv1
1 May 2023
Triple some in array
- We will discuss the multiple approaches to solve this problem and finally we will write its Java code. The easiest approach is to use three loops to solve the problem. The expected time complexity is 1 square without using any extra space. The brute force approach is the simplest approach or you can say the brute force approach. The time complexity is bigger of and cube so basically we are using three four loops right and it 's a space complexity is big o of 1 as we are not using any extra space right. After that, basically we return the value true. If the array is sorted we do n't have to make all possible sets right, we can do the sum of the three numbers and accordingly move the pointers so let me explain this so we have given this array right. First, let's sort this array and then use two pointers to solve the problem.
Triple some in array
- We will discuss the multiple approaches to solve this problem and finally we will write its Java code. The easiest approach is to use three loops to solve the problem. The expected time complexity is 1 square without using any extra space. The brute force approach is the simplest approach or you can say the brute force approach. The time complexity is bigger of and cube so basically we are using three four loops right and it 's a space complexity is big o of 1 as we are not using any extra space right. After that, basically we return the value true. If the array is sorted we do n't have to make all possible sets right, we can do the sum of the three numbers and accordingly move the pointers so let me explain this so we have given this array right. First, let's sort this array and then use two pointers to solve the problem.
6 Jul 2023
Read by 1 person
Read by 1 person
1 May 2023
Already have an account? Log in
Read by 1 person
lalithashwin156Lv10
1 May 2023
Already have an account? Log in
Read by 1 person
prithivira85Lv4
1 May 2023
Already have an account? Log in
Read by 1 person
nishareyansh2001Lv10
1 May 2023
Already have an account? Log in