private static boolean containsDuplicate(List<Character> chars, int start, int end) {
        for (int i = start; i <= end-1; i++) {
            if (chars.get(i)== chars.get(end)) {
                return true;
            }
        }
        return false;
    }