File tree Expand file tree Collapse file tree 3 files changed +9
-5
lines changed
algorithms/two_pointers/three_sum Expand file tree Collapse file tree 3 files changed +9
-5
lines changed File renamed without changes.
Original file line number Diff line number Diff line change 44def three_sum (nums : List [int ]) -> List [List [int ]]:
55 """
66 Complexity Analysis:
7- Time Complexity: O(nlogn) + O(n^2) = O(n^2) the O(nlogn) is due to sorting
7+
8+ Time Complexity: O(nlog(n)) + O(n^2) = O(n^2) the O(nlog(n)) is due to sorting
89 Space Complexity: O(1) as no extra space is taken up
9- @param nums: input list of integers
10- @return: lists of lists of integers
10+
11+ Args:
12+ nums (list): input list of integers
13+ Return:
14+ list: list of lists of integers
1115 """
1216 result = []
13- # Time Complexity: O(nlogn )
17+ # Time Complexity: O(nlog(n) )
1418 nums .sort ()
1519
1620 for idx , num in enumerate (nums ):
Original file line number Diff line number Diff line change 11import unittest
22
3- from algorithms .arrays .three_sum import three_sum
3+ from algorithms .two_pointers .three_sum import three_sum
44
55
66class ThreeSumTestCases (unittest .TestCase ):
You can’t perform that action at this time.
0 commit comments