public static void main(String args[]) {
        Map<Character, Integer> index = new HashMap<>();
        index.put('a', 0);
        index.put('b', 1);
        index.put('c', 2);

        char input[][] = {{'b', 'b', 'a'}, {'c', 'b', 'a'}, {'a', 'c', 'c'}};
        SymbolExpressionEvaluation sbe = new SymbolExpressionEvaluation();
        System.out.println(sbe.evaluateExpression(input, index, "bbbbac".toCharArray(), 'a'));
    }
Date 01/06/2016
@author Tushar Roy
Let there be a binary operation for 3 symbols a, b, c and result of these binary operation given in a table.
Given an expression of these 3 symbols and a final result, tell if this expression can be parenthesize in certain
way to produce the final result.

Time complexity is O(n^4)
Space complexity is O(n^3)
src/com/interview/dynamic/SymbolExpressionEvaluation.java