摘要: Python解法: def relativeSortArray(arr1, arr2): arr = [0 for _ in range(110)] new = [] for a in range(len(arr1)): arr[arr1[a]] += 1 for b in range(len(ar 阅读全文
posted @ 2019-12-25 18:07 HannahGreen 阅读(217) 评论(0) 推荐(0) 编辑
摘要: C++解法: #include <iostream> #include <vector> #include <map> #include <algorithm> using namespace std; class Solution { public: vector<vector<int>> all 阅读全文
posted @ 2019-12-25 16:21 HannahGreen 阅读(196) 评论(0) 推荐(0) 编辑
摘要: Python解法: class Solution: def largestPerimeter(self, A: List[int]) -> int: A.sort() for i in range(len(A) - 3, -1, -1): if A[i] + A[i+1] > A[i+2]: ret 阅读全文
posted @ 2019-12-25 15:47 HannahGreen 阅读(193) 评论(0) 推荐(0) 编辑
摘要: Python解决方法: class Solution(object): def sortArrayByParityII(self, A): j = 1 for i in xrange(0, len(A), 2): if A[i] % 2: while A[j] % 2: j += 2 A[i], A 阅读全文
posted @ 2019-12-25 10:20 HannahGreen 阅读(191) 评论(0) 推荐(0) 编辑