mirror of
https://github.com/TheAlgorithms/Ruby
synced 2025-01-14 08:01:05 +01:00
Update data_structures/arrays/sort_squares_of_an_array.rb
Co-authored-by: Vitor Oliveira <vbrazo@gmail.com>
This commit is contained in:
parent
f9e7cd677d
commit
75aaa6e910
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue