https://leetcode-cn.com/problems/squares-of-a-sorted-array/
- 思路:先平方,再冒泡排序,结果
class Solution(object):
def sortedSquares(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
c = []
for i in nums:
c.append(i*i)
def bubbleSort(arr):
for i in range(1,len(arr)):
for j in range(0,len(arr)-i):
if arr[j]>arr[j+1]:
arr[j],arr[j+1] = arr[j+1],arr[j]
return arr
return(bubbleSort(c))