Skip to content

Commit b25c4ca

Browse files
committed
Create 977.squares-of-a-sorted-array.py
two solutions
1 parent 82f5116 commit b25c4ca

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

977.squares-of-a-sorted-array.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Solution(object):
2+
def sortedSquares(self, A):
3+
"""
4+
:type A: List[int]
5+
:rtype: List[int]
6+
"""
7+
for i in range(len(A)):
8+
A[i] = A[i] ** 2
9+
return sorted(A)
10+
11+
12+
if __name__ == '__main__':
13+
A = [-4, -1, 0, 3, 10]
14+
print(Solution().sortedSquares(A))

0 commit comments

Comments
 (0)