Algorithms & Properties
Possible sum of K distinct integers between 1 and N
let the sum be S,
we can form all numbers till $\dfrac{N(N+1)}{2}$
but if we are to use fixed K digits, the Range will be limited to $(K)(N)+(K-1)$
Sliding Window
- Use deque or vector when you also need to access every element while sliding
- Sliding Window for Maximum sum of K continous elements of vector vec
| |
Photo by Pawel Czerwinski on Unsplash
