(String []args)
| 15 | return maximum_so_far; |
| 16 | } |
| 17 | public static void main(String []args){ |
| 18 | int size; |
| 19 | System.out.println("Enter size of array"); |
| 20 | Scanner sc=new Scanner(System.in); |
| 21 | size=sc.nextInt(); |
| 22 | int[] arr = new int[size]; |
| 23 | System.out.println("Enter the elements of the array: "); |
| 24 | for(int i=0; i<size; i++) |
| 25 | { |
| 26 | //reading array elements from the user |
| 27 | arr[i]=sc.nextInt(); |
| 28 | } |
| 29 | int sum=maxSubArraySum(arr); |
| 30 | System.out.println("Maximum contiguous sum is "+sum); |
| 31 | } |
| 32 | } |
| 33 | /* |
| 34 | Time Complexity: O(n) |
nothing calls this directly
no test coverage detected