mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-09 03:34:02 +08:00
update 0028.实现strStr:添加复杂度分析
This commit is contained in:
@ -444,6 +444,8 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
```
|
```
|
||||||
|
* 时间复杂度: O(n + m)
|
||||||
|
* 空间复杂度: O(m), 只需要保存字符串needle的前缀表
|
||||||
|
|
||||||
# 前缀表(不减一)C++实现
|
# 前缀表(不减一)C++实现
|
||||||
|
|
||||||
@ -540,6 +542,9 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
* 时间复杂度: O(n + m)
|
||||||
|
* 空间复杂度: O(m)
|
||||||
|
|
||||||
|
|
||||||
# 总结
|
# 总结
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user