Back to course home
0% completed
Vote For New Content
Is there a typo in the space complexity for the triplets?
Kartiki Sharma
Dec 8, 2024
Triplets storage: The space used to store the resulting triplets is , where
Kis the number of triplets found. In the worst case, this could be proportional to N^2, especially if there are many valid triplets.
Shouldn't this be O(N)? Given an array of 3 items, it is only possible for at most one triplet to exist in the best case, which is N/3.
0
0
Comments
Comments
On this page