Amazon VO 面试真题解析:会议室调度与基础计算器(Meeting Rooms II / Basic Calculator)

24次阅读
没有评论

Given an array of meeting time intervals intervals where intervals[i] = [starti, endi], return the minimum number of conference rooms required.

Implement a function that evaluates a basic arithmetic expression string containing non-negative integers, the binary operators +, -, *, /, and parentheses (). The expression may contain spaces.

  • You may assume the input is a valid expression.
  • Integer division should truncate toward zero (so -3 / 2 = -1).
  • Return an integer result.

这份题目包含两个经典面试方向:第一个是会议室分配问题,核心是将所有区间按开始或结束时间排序,再通过扫描线、最小堆或双指针统计任意时刻同时进行的会议数量,最大并发数就是所需会议室数;第二个是基础计算器问题,需要正确处理数字、多种运算符和括号,通常用栈配合递归或迭代解析来维护当前表达式的优先级,并特别注意除法要向 0 截断。整体考察的是区间处理、栈、表达式解析和边界条件处理能力。

正文完
 0