FastPrepValid Parenthesis String
Problems/Valid Parenthesis String

Valid Parenthesis String

Oracle logoOracle● MediumFULLTIMEPHONE SCREEN
QuestionFunctionExamplesConstraints

Problem statement

Source note: The interview report establishes the task identity and central capability. This practice contract supplies only the portable interface, deterministic boundary rules, and output serialization needed for consistent execution.

Given a string s containing '(', ')', and '*', return whether it can become a valid parenthesis string.

Each '*' may independently represent an opening parenthesis, a closing parenthesis, or the empty string.

Function

checkValidString(s: String) → boolean

Examples

Example 1

s = "(*)"return = true

The wildcard may be empty.

Example 2

s = "(*))"return = true

Treat the wildcard as an opening parenthesis.

Constraints

  • 0 <= s.length <= 10^5.
  • s contains only (, ), and *.

More Oracle problems

  • Maximum Subarray Sum with One DeletionONSITE INTERVIEW · Seen Nov 2026
  • Shortest Deletion for Distinct CharactersONSITE INTERVIEW · Seen Nov 2026
  • Count Dropped Rate-Limited RequestsONSITE INTERVIEW · Seen Nov 2026
All Oracle interview questionsSee Oracle hiring insights
Saved
class Solution {
    public boolean checkValidString(String s) {
      // write your code here
    }
}
Checking account…