mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-09 03:34:02 +08:00
Merge pull request #2375 from fifi1120/fiona-branch
添加Kama54.替换数字的Python版本
This commit is contained in:
@ -235,7 +235,15 @@ func main(){
|
|||||||
|
|
||||||
|
|
||||||
### python:
|
### python:
|
||||||
|
```Python
|
||||||
|
class Solution:
|
||||||
|
def change(self, s):
|
||||||
|
lst = list(s) # Python里面的string也是不可改的,所以也是需要额外空间的。空间复杂度:O(n)。
|
||||||
|
for i in range(len(lst)):
|
||||||
|
if lst[i].isdigit():
|
||||||
|
lst[i] = "number"
|
||||||
|
return ''.join(lst)
|
||||||
|
```
|
||||||
### JavaScript:
|
### JavaScript:
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user