Grokking LinkedIn Coding Interview
Ask Author
Back to course home

0% completed

Vote For New Content
Kartiki Sharma
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 K is 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