题目:在一个二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个函数,输入这样一个二维数组和整数,判断数组中是否含有该整数。class Solution { func find(_ n: [[Int]],_ i: Int) -> Bool { guard n.count > 0 else { ...
题目:请实现一个函数,把字符串中的每个空格替换成"%20"。例如输入"We are happy.",则输出"We%20are%20happy."。class Solution { func replace(_ s: String) -> String { guard s.count > 0 else { retur...
import Foundation class BubbleSortSolution { func sort(_ n: [Int]) -> [Int] { var nums = n for i in 0..<n.count { for j in 0..&...