Update data_structures/arrays/sort_squares_of_an_array.rb

Co-authored-by: Vitor Oliveira <vbrazo@gmail.com>
This commit is contained in:
Jessica Kwok 2021-03-10 15:03:17 -08:00 committed by GitHub
parent f9e7cd677d
commit 75aaa6e910
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -51,8 +51,8 @@ print(sorted_squares([4, -1, -9, 2]))
#
# Approach 3: solving without ruby sort method. Using two-pointers
#
# Time complexity: O(n)
# Space complexity: O(n)
# Time complexity: O(n), where n is the length of the array.
# Space complexity: O(n), if you take output into account and O(1) otherwise.
#
def sorted_squares(nums)
p1 = 0