Generating subarrays

getting unwanted outputs also

Hi @nirupama1
please share your code ide so that i can have a look.