You are viewing a single comment's thread. Return to all comments →
It's not 2+1, it's (k//2)+1.
2+1
(k//2)+1
Consider k=3. You want to add max(counts[1], counts[2]) to count. Since 3//2 = 1, without +1 you would have range(1, 1), which is [].
k=3
max(counts[1], counts[2])
count
3//2 = 1
+1
range(1, 1)
[]
Seems like cookies are disabled on this browser, please enable them to open this website
Non-Divisible Subset
You are viewing a single comment's thread. Return to all comments →
It's not
2+1
, it's(k//2)+1
.Consider
k=3
. You want to addmax(counts[1], counts[2])
tocount
. Since3//2 = 1
, without+1
you would haverange(1, 1)
, which is[]
.