i try to do it on pyton, but i am new in this language.
lets say k=3 and we have split array like:
The, sky, is, blue, and, the, sun, is, bright
what i want to get is to put in each index on the new list k words from the original list.
index 0: The sky is
index 1: blue and the
index 2: sun is bright
this is what i do:
for i in range(len(mylist) - k + 1):
ren=i+k-1
for j in range(ren):
newListWithKLenOfWord.insert(i, mylist[j] + " ")
but i dont no why its not work for me. in java what i think for this problem is:
for i to n-k
for j+i to i+k
arr[i] =arr[i] + arr[j]
thanks.