package leetcode;

/**
 * https://leetcode.com/problems/valid-parenthesis-string/
 */
public class Problem678 {
    public boolean checkValidString(String s) {
        // TODO
        return false;
    }

    public static void main(String[] args) {
        Problem678 prob = new Problem678();
        System.out.println(prob.checkValidString("()")); // true
        System.out.println(prob.checkValidString("(*)")); // true
        System.out.println(prob.checkValidString("(*))")); // true
        System.out.println(prob.checkValidString(")(")); // false
        System.out.println(prob.checkValidString("()()")); // true
    }
}

@@ -12,16 +12,41 @@
 tcode;%0A%0A
+import java.util.Stack;%0A%0A
 /**%0A * h
@@ -190,35 +190,800 @@
     
-// TODO%0A        return fals
+if (s.length() %25 2 != 0) %7B%0A            return false;%0A        %7D%0A        Stack%3CCharacter%3E stack = new Stack%3C%3E();%0A        for (int i = 0; i %3C s.length(); i++) %7B%0A            if (s.charAt(i) == '(' %7C%7C s.charAt(i) == '*') %7B%0A                stack.push(s.charAt(i));%0A            %7D else if (s.charAt(i) == ')') %7B%0A                if (stack.peek() == '(' %7C%7C stack.peek() == '*') %7B%0A                    stack.pop();%0A                %7D else %7B%0A                    return false;%0A                %7D%0A            %7D%0A        %7D%0A        if (stack.size() %25 2 != 0) %7B%0A            return false;%0A        %7D%0A        while (!stack.isEmpty()) %7B%0A            char a = stack.pop();%0A            char b = stack.pop();%0A            if (a == '(' %7C%7C b == ')') %7B%0A                return false;%0A            %7D%0A        %7D%0A        return tru
 e;%0A 
@@ -1200,32 +1200,34 @@
 (*)%22)); // true%0A
+//
         System.o
@@ -1269,32 +1269,34 @@
 *))%22)); // true%0A
+//
         System.o
@@ -1345,16 +1345,18 @@
 / false%0A
+//
         
@@ -1410,20 +1410,91 @@
 )); // true%0A
+//        System.out.println(prob.checkValidString(%22(**())%22)); // true%0A
     %7D%0A%7D%0A

Update problem 678