Compute meeting rooms and evaluate RPN
Company: Bloomberg
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: easy
Interview Round: Technical Screen
You are given two independent coding tasks.
## Task 1: Minimum number of meeting rooms
Given a list of meeting time intervals `intervals`, where each interval is `[start, end)` with integer times and `start < end`, compute the minimum number of conference rooms required so that no meetings assigned to the same room overlap.
- Two meetings do **not** overlap if one ends at the exact time the other starts (because intervals are half-open `[start, end)`).
**Input:** `intervals: List[List[int]]`
**Output:** `int` (minimum number of rooms)
**Constraints (typical):**
- `0 <= intervals.length <= 10^5`
- `0 <= start < end <= 10^9`
## Task 2: Evaluate an expression in Reverse Polish Notation
Given an array of strings `tokens` representing an arithmetic expression in Reverse Polish Notation (postfix form), evaluate the expression and return the result as an integer.
- Valid operators are `"+"`, `"-"`, `"*"`, `"/"`.
- Each operand is an integer string (may be negative).
- Division should truncate toward zero.
- The input expression is guaranteed to be valid.
**Input:** `tokens: List[str]`
**Output:** `int`
**Constraints (typical):**
- `1 <= tokens.length <= 10^4`
- Operands fit in 32-bit signed integer range; intermediate results fit in 32-bit signed integer range.
Quick Answer: This multi-part question evaluates interval reasoning and resource-allocation skills for meeting room scheduling alongside stack-based expression evaluation for Reverse Polish Notation, covering core algorithms and data structures competencies.
Minimum Meeting Rooms
Given half-open intervals [start,end), return the minimum rooms needed. Meetings ending at the same time another starts do not overlap.
Examples
Input: ([[0, 30], [5, 10], [15, 20]],)
Expected Output: 2
Input: ([[7, 10], [10, 12]],)
Expected Output: 1
Input: ([],)
Expected Output: 0
Hints
- Sweep start/end events; process ends before starts at the same time.
Evaluate Reverse Polish Notation
Evaluate a valid postfix expression with +, -, *, /. Division truncates toward zero.
Examples
Input: (['2', '1', '+', '3', '*'],)
Expected Output: 9
Input: (['4', '13', '5', '/', '+'],)
Expected Output: 6
Input: (['10', '6', '9', '3', '+', '-11', '*', '/', '*', '17', '+', '5', '+'],)
Expected Output: 22
Hints
- Use a stack of operands.