K-Subarray

You will be given an array of length n. You need to divide the array in some part where length of every part will be exactly k. Firstly, you will take first k elements of the array for the 1st part, then the next k elements to the 2nd part and so on. If there is less than k elements remain after making some parts (possibly zero), we will not take these elements to any part. That means, we will not take the last (n mod k) elements to any part. Let’s call a part of k length as k-subarray.


This is a companion discussion topic for the original entry at https://toph.co/p/k---subarray