Update docs/chapter_computational_complexity/time_complexity.md

Co-authored-by: Justin Tse <xiefahit@gmail.com>
pull/196/head
Yudong Jin 2 years ago committed by GitHub
parent a29a584b6f
commit d5969e4070
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1013,7 +1013,7 @@ $$
```typescript title="time_complexity.ts"
/* 线性阶(遍历数组) */
function arrayTraversal(nums: number[]) {
function arrayTraversal(nums: number[]): number {
let count = 0;
// 循环次数与数组长度成正比
for (let i = 0; i < nums.length; i++) {

Loading…
Cancel
Save