Confluent logo

Confluent

Mountain View, CASoftware

Interview Questions

Buying Chairs Problem

Asked at Confluent
technical
arrays
simulation

Given a string array where each string represents employee chair events:

Characters represent actions:

  • 'C': New employee joins, needs a chair
  • 'U': Employee goes to meeting room (frees chair)
  • 'L': Employee returns from meeting (needs chair)
  • 'R': Employee leaves company (frees chair)

Task: Calculate minimum chairs needed to purchase.

Example: Input: ["C", "U", "L", "R"] Output: 1

Rules:

  • Start with 0 chairs
  • Must buy new chair if no spare chairs available
  • Track available chairs as employees move
  • Return array of minimum chairs needed for each string

Note: Need to buy chair immediately when needed (can't wait for future events).

Minimum Health for Gaming

Asked at Confluent
technical
algorithms
heap

Calculate minimum initial health needed to defeat opponents in a game.

Requirements:

  • Start with n opponents at first level
  • initial_players[i] represents opponent strength
  • next_players list shows new players added each level
  • Must defeat player at position 'rank' each level
  • Health decreases by defeated opponent's strength
  • Must keep health >= 0 throughout game

Example:

initial_players = [3, 2, 4]
next_players = [[1, 5], [2]]
rank = 2

Solution approach:
- Maintain min heap of size 'rank'
- Track health changes after each battle
- Consider new players added each level

Sudoku Validator and Solver

Asked at Confluent
technical
backtracking
algorithms

Implement a Sudoku validator and solver.

Part 1: Validation

  • Check if current board state is valid
  • Verify rows, columns, and 3x3 boxes
  • Handle partially filled boards

Part 2: Solver

  • Implement backtracking solution
  • Fill empty cells (represented by '.')
  • Ensure all solutions are valid

Follow-up:

  • Optimize solution for large boards
  • Handle multiple valid solutions
  • Implement visualization of solving process

Wildcard Pattern Matching

Asked at Confluent
technical
strings
dynamic programming

Implement a wildcard pattern matching function.

Requirements:

  • Match literal characters (a-z)
  • Support '*' wildcard (matches 0 or more of any char)
  • Initially focus on 0-1 wildcards
  • Later handle multiple wildcards

Examples:

pattern: "a*b", string: "acb" → true
pattern: "a*", string: "abc" → true
pattern: "a*c", string: "ab" → false

Follow-up:

  • Handle multiple wildcards efficiently
  • Optimize for long strings
  • Consider memory usage

Share Your Experience at Confluent