public static void main(String args[]) {
        MaxSumForNonAdjacentElements msn = new MaxSumForNonAdjacentElements();
        int arr[] = { 2, 10, 13, 4, 2, 15, 10 };
        System.out.println(msn.maxSum(arr));
        System.out.println(msn.maxSum(arr, arr.length-1));

    }
Find maximum sum from left to right ignoring first element.
Find maximum sum from right to left ignoring last element.
Maximum of two will be the answer. It gurantees that both first and last element
will be not selected together.
src/com/interview/dynamic/MaxSumForNonAdjacentElements.java