2 2 votes Explain this question? Algorithms + – Deepak Yadav 692 views answer comment Share Follow Print See all 3 Comments 3 3 Comments reply Samujjal Das commented Jan 6, 2017 reply Follow flag You are given an array of n numbers and a number K. You have to find three elements from the arra whose sum is equal to K. Find the complexity of the algorithm using Brute Force and optimal approach. 0 0 replyShare dd commented Jan 6, 2017 reply Follow flag Brute force: Use three for loops and check for each combination of three elements. $O(n^3)$ Otherwise, Sort array $n \log n$ Use greedy approach by fixing two elements and scanning using third element. Overall n square complexity 0 0 replyShare dd commented Jan 6, 2017 reply Follow flag also here : http://www.geeksforgeeks.org/find-a-triplet-that-sum-to-a-given-value/ 1 1 replyShare Please log in or register to add a comment.