Update space_complexity.md

Fix the Go code.
pull/194/head
Yudong Jin 2 years ago committed by GitHub
parent 047e15e8d5
commit 2465db1eff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -219,11 +219,11 @@ comments: true
```go title="" ```go title=""
func algorithm(n int) { func algorithm(n int) {
a := 0 // O(1) a := 0 // O(1)
b := make([]int, 10000) // O(1) b := make([]int, 10000) // O(1)
var nums []int var nums []int
if n > 10 { if n > 10 {
nums = make([]int, 10000) // O(n) nums := make([]int, n) // O(n)
} }
fmt.Println(a, b, nums) fmt.Println(a, b, nums)
} }

Loading…
Cancel
Save