Back to course home
0% completed
Vote For New Content
Space complexity explanation
umesh
Apr 25, 2025
To form a triplet, you can chose first number in n ways. For each first number, second number can be chosen from the remaining n-1 numbers. But you don't get any choice for the third number, it must be -1*(first_num + second_num). Thus total of n*(n-1) or O(n^2) possibilities.
0
0
Comments
Comments
On this page
Problem Statement
Examples
Example 2
Solution
Step-by-Step Algorithm
Algorithm Walkthrough
Code
Complexity Analysis:
Time Complexity
Space Complexity