import Foundation class MyTreeNodeSolution { //递归 func preorderTraversal(_ root: TreeNode?,_ n: inout [Int]) { if root == nil { return } ...
import Foundation class SelectSortSolution { func sort(_ n: [Int]) -> [Int] { var s = n for i in 0..<s.count { let j =...
import Foundation class QuickSortSolution { func sort(_ n: [Int]) -> [Int] { var s = n quickSort(&s, 0, n.count - 1) return s } func quickS...
import Foundation class MergeSortSolution { func sort(_ n: [Int]) -> [Int] { var s = n sortArray(&s, 0, n.count - 1) return s } func sortAr...