Suppose I have an array/list like this:
a =[5,8,9,6,5,4,5,6,1]
Then the Output should be:
a =[[5,8],[9,6],[5,4],[5,6],[1]]
It's not necessary that I have to combine every two elements. It can be 2 or 3 or 4 but that's something I should be able to decide. I tried it multiple ways but was unable to achieve the result
Any help is appreciated.