Skip to content

Commit 64dd4ef

Browse files
authored
Update 992-subarrays-with-k-different-integers.js
1 parent 7a2917e commit 64dd4ef

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

992-subarrays-with-k-different-integers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const subarraysWithKDistinct = function(A, K) {
77
let res = 0
88
let prefix = 0
99
const m = new Array(A.length + 1).fill(0)
10-
for (let i = 0, j = 0, cnt = 0; i < A.length; i++) {
10+
for (let i = 0, j = 0, cnt = 0, len = A.length; i < len; i++) {
1111
if (m[A[i]]++ === 0) cnt++
1212
if (cnt > K) {
1313
m[A[j++]]--

0 commit comments

Comments
 (0)