Skip to content

Commit 157431e

Browse files
authored
Update README.markdown
Find a kth smallest element should use a[k-1]
1 parent d4d471b commit 157431e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Kth Largest Element/README.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Now, all we must do is take the value at index `a.count - k`:
4040
a[a.count - k] = a[8 - 4] = a[4] = 9
4141
```
4242

43-
Of course, if you were looking for the k-th *smallest* element, you'd use `a[k]`.
43+
Of course, if you were looking for the k-th *smallest* element, you'd use `a[k-1]`.
4444

4545
## A faster solution
4646

0 commit comments

Comments
 (0)