Given a binary array nums, return the maximum length of a contiguous subarray with an equal number of 0 and 1.

  • Hash Map with key sum and value index
  • Treat 0 as -1 and 1 as 1 and get sum
  • If sum repeats calculate distance

class Solution {

    public boolean isPalindrome(String s) {

        char[] app = new char[s.];

        String str = s.lowercase();

        for(int i = 0; i < str.length(); i++) {

            int diff = str.charAt(i) - ‘a’;

            if(diff <= 26) {

                app[i] = str.charAt(i);

            }

        }

        for(int i = 0; i < app.length/2; i++) {

            if(app[i] != app[app.length-i-1]) {

                return false;

            }

        }

        return true;

    }

}