MockDojo

Question bank, Coding, Top interview set: Greedy

Valid Parenthesis String

With '*' allowed to be '(', ')' or empty, is the string balanced?

30 minutes, for junior, mid-level, senior engineers

How the interview runs

  1. 1.Clarify. Restate the problem in your own words and ask anything you'd want to know about the input.
  2. 2.Approach. What's your approach? Start with the brute force if it helps, then improve it.
  3. 3.Code. Go ahead and write it in the editor. Talk me through it as you go.
  4. 4.Test. Walk through your code with an example, including an edge case.
  5. 5.Complexity. What's the time and space complexity, and could you do better?

What you're graded on

  • Clarifying questions10 pts
  • Optimal approach30 pts
  • Correct, clean code30 pts
  • Testing10 pts
  • Complexity analysis20 pts

Practice this one for real

Answer it phase by phase, then get the rubric score, what you missed and the model answer outline.

Unlock with Lifetime