Can i call it a subarry?

IF ARRAY IS
[1,2,3]
can the subarry be 1,2,3
if yes its maximum sbarray sum will be1+2+3=6
but i am getting 5 as the answer

yes any contigous part in array is subarray.
1+2+3 is the maximum subarray sum in [1,2,3] i.e. 6.
Share your code where you are getting 5 as the answer

i got the error thanks

1 Like