Maximum subarray sum 1

How 13-15 subarray be print from 9 values . Explain in detail @virendra

Hello @Nikhil-Aggarwal-2320066674901389,

If you were trying to tag me, then that’s not my name:joy:

Now, coming back to your question:
Can you please, explain your question properly?

If you are asking that how can so many sub-arrays be created using 9 value.
then, lets understand this using a lesser number of elements.

Suppose, you have 3 elements in an array: 1,2,3
You are required to print all the subarrays possible.

There are few points you should know:

  1. i keeps track of left index of the subarray.
  2. j keeps track of the right index.
  3. The third for loop prints the subarray from i to j
  • for i=0:
    1.j=0,
    subarray=[a[0]]
    2.j=1
    subarray=[a[0],a[1]]
    3.j=2
    subarray=a[a[0],a[1],a[2]]

  • for i=1
    1.j=1
    subarray=[a[1]]
    2.j=2
    subarray=a[a[1],a[2]]

  • for i=2
    1.j=2
    subarray=[a[2]]

Hence, there are in total 6 sub-arrays possible for an array of 3 elements.

Hope, this would help.
Give a like, if you are satisfied.