Mock 01 — Beginner

Interview type: First-time mock / warm-up Target role: Intern, new grad, first-ever interview practice Time limit: 30 minutes Format: 1 easy problem Hints policy: Unlimited hints with -1 to score per hint Primary goal: Build the habit loop of clarify → brute force → optimize → code → test. Optimization is not the focus.


What This Mock Tests

This mock exists to break the most common beginner failure mode: silent coding. You will be scored more on whether you communicated than on whether your code is optimal. A correct silent solution scores lower than a slightly buggy spoken one.

The scoring rubric weights as follows:

DimensionWeight
Communication (#10)
Clarifying questions (#2)
Testing (#8)
Code quality (#7)
Correctness (#5)
Complexity (#6)
All others0.5×

Pick One Problem (interviewer’s choice; for self-mock, pick at random)

Problem A — Reverse a String

Write a function that reverses a string. The input is given as a list of characters s. Modify s in-place; do not allocate a new list.

Examples:

Input:  ['h', 'e', 'l', 'l', 'o']
Output: ['o', 'l', 'l', 'e', 'h']

Input:  ['H', 'a', 'n', 'n', 'a', 'h']
Output: ['h', 'a', 'n', 'n', 'a', 'H']

Constraints: 1 ≤ |s| ≤ 10^5. Each character is printable ASCII.

Problem B — Valid Parentheses

Given a string s containing only ()[]{}, determine if it is valid. Valid means: brackets close in the right order, every opener has a matching closer of the same type.

Examples:

"()"      → True
"()[]{}"  → True
"(]"      → False
"([)]"    → False
"{[]}"    → True
""        → True

Constraints: 0 ≤ |s| ≤ 10^4.

Problem C — Find Maximum in Array

Given an array of integers, return the maximum value. Do not use the language’s built-in max().

Examples:

[3, 1, 4, 1, 5, 9, 2, 6] → 9
[-3, -1, -7]              → -1
[42]                      → 42

Constraints: 1 ≤ |a| ≤ 10^5. -10^9 ≤ a[i] ≤ 10^9.


Expected Communication Style

You should:

  1. Restate the problem in your own words. (“So I need to reverse this list of characters in place, meaning no new list allocation.”)
  2. Ask 2+ clarifying questions even if they feel obvious. (“Should I handle empty input? What’s the max length?”)
  3. State 1+ example trace out loud. (“For [h, e, l, l, o], I’d swap positions 0 and 4, then 1 and 3, leaving 2 alone.”)
  4. Articulate brute force first. Even for these problems — there’s an obvious approach.
  5. Code while narrating. “I’ll use two pointers, left and right, swap and move toward center until they meet.”
  6. Test out loud. Walk through the example, then try empty input, then single element.

You should not:

  • Type silently for >30 seconds
  • Skip clarifying questions because the problem “is obvious”
  • Skip testing because the code “looks right”
  • Assume the interviewer is following — narrate every decision

Common Failure Modes

  1. Silent coding. Most common. -3 to communication.
  2. Skipping clarification. “Empty string?” was not asked → -1.
  3. No testing. Submitted without walking through. -2 to testing.
  4. Skipping brute force. Wrote the optimal directly without acknowledging the simpler approach. -1 to brute force.
  5. Using a built-in. Problem C says no max() — using it is an instant fail of that problem.

Passing Bar

  • Total score: 35/70 (average 2.5)
  • Communication dimension: 3+ (mandatory)
  • Code: works on all given examples
  • One unprompted test case beyond the given examples

If you score 35+ but communication is below 3: re-do this mock. The score is misleading; the failure mode isn’t fixed.


Follow-up Questions (Interviewer may ask)

For A:

  • What’s the complexity? (O(N) time, O(1) space.)
  • What if the string is in a Unicode encoding with multi-byte characters? (Character iteration is no longer index-1; need to handle codepoints.)
  • What if the string is immutable in your language? (Java strings, Python strings — must allocate.)

For B:

  • Complexity? (O(N) time, O(N) worst-case space for the stack.)
  • What if you also need to return the position of the first invalid bracket? (Track index when pushing; return index on failed pop.)
  • What if the input can have non-bracket characters mixed in? (Skip them or treat as invalid — clarify.)

For C:

  • Complexity? (O(N) time, O(1) space.)
  • What if the array is empty? (Undefined; throw, return None, or return INT_MIN — clarify.)
  • What if it’s a stream and you can’t store it all? (Maintain running max with O(1) state.)

Required Tests

For all problems:

  • The given examples
  • Empty input (where the constraint allows)
  • Single-element input
  • One additional edge case you choose

For A: a palindrome input (e.g., ['r', 'a', 'c', 'e', 'c', 'a', 'r']). For B: nested mismatch like "([)]" and just an opener "(" (should be False). For C: all-negative input and all-identical input.


Required Complexity Explanation

State out loud:

  • Time complexity in Big-O
  • Space complexity
  • Why those bounds are tight (or whether they could be improved)

For these problems, the optimal is also the simplest. Acknowledge that briefly.


Self-Evaluation Template

Copy this into your notes after the mock:

Mock 01 — Beginner
Date: _______
Problem chosen: _______
Time taken: _____ min (limit: 30)

Scores (1–5):
[ ] 1. Problem Understanding
[ ] 2. Clarifying Questions
[ ] 3. Brute Force
[ ] 4. Optimization
[ ] 5. Correctness
[ ] 6. Complexity Analysis
[ ] 7. Code Quality
[ ] 8. Testing
[ ] 9. Debugging (if applicable)
[ ] 10. Communication
[ ] 11. Follow-ups
[ ] 12. Language/Runtime
[ ] 13. Tradeoffs
[ ] 14. Production Awareness

Total: ___/70

What went well:

What went poorly:

Specific bug or moment of confusion:

What to drill before next mock:

What to Do If You Fail

If you scored below 35:

  1. Identify the dimension with the lowest score.
  2. Re-do this same mock with a different problem (A/B/C). Focus only on that dimension.
  3. If communication is the issue, record yourself doing 3 LC easies aloud over the next week. Listen back.
  4. Do not move to Mock 02 until you pass Mock 01 twice in a row. Foundational habits matter more than progression.