在一个 n * m 的二维数组中,每一行都按照从左到右 非递减 的顺序排序,每一列都按照从上到下 非递减 的顺序排序。请完成一个高效的函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。
链接:https://leetcode.cn/problems/er-wei-shu-zu-zhong-de-cha-zhao-lcof
class Solution:
def replaceSpace(self, s: str) -> str:
#顺序变量
if not s:
return ''
strLen = len(s)
resulList = []
for i in range(strLen):
if s[i] == ' ':
resulList.append('%20')
else:
resulList.append(s[i])
return ''.join(resulList)
#使用python的一些嵌入函数
newList = s.split(' ')
resulList = []
for c in newList:
resulList.append(c)
resulList.append('%20')
return ''.join(resulList[:-1])