They asked me to solve the maximum subarray problem on pen and paper.
Anonymous
public class MaxOfSubArray { public static void main(String[] args) { // TODO Auto-generated method stub int maxSum=0, currSum=0, i; int[] input = {1, -2, 3, 10, -4, 7, 2, -5}; for(i=0;i maxSum) { maxSum = currSum; } } System.out.println(currSum); System.out.println(maxSum); } }
Check out your Company Bowl for anonymous work chats.