public int maxProduct(int arr[]){
        int RGN[] = new int[arr.length];
        int LGN[] = new int[arr.length];
        RGN[arr.length-1] = arr[arr.length-1];
        int max = arr[arr.length-1];
        for(int i=arr.length-2; i>=0; i--){
            if(max < arr[i]){
                max = arr[i];
            }
            if(max > arr[i]){
                RGN[i] = max;
            }
            else{
                RGN[i] = 0;
            }
        }
        LGN[0] = 0;
        //This can be implemented using an AVL tree instead of this way which will
        //make it O(nLogn) operation insteado ofO(n2).
        for(int i=1; i < arr.length; i++){
            getLGN(arr,i,LGN);
        }
        int maxProduct = 0;
        for(int i=1; i < arr.length-1; i++){
            int product = arr[i]*LGN[i]*RGN[i];
            if(maxProduct < product){
                maxProduct = product;
            }
        }
        return maxProduct;
    }
http://www.geeksforgeeks.org/increasing-subsequence-of-length-three-with-maximum-product/
Keep two arrays which keeps max from current position to right side
Other array keeps max on left size which is smaller than current element
Once you have these two arrays from 2nd to 2nd last position keep multiplying
elements at 3 arrays index position to get max product
Test cases
Negative numbers
0 in the input
src/com/interview/array/IncreasingSubsequnceOfLength3WithMaxProduct.java