微软 OA 新鲜面经

也叫 OTS - online technical screen

第一题找bug,入参是 unsigned int,所以不会为负数,这就是bug,需要用signed int
第二题,LC 原题 110. Balanced Binary Tree
第三题,类似 https://leetcode.com/problems/inorder-successor-in-bst/

  1. Inorder Successor in BST
    Given a binary search tree and a node in it, find the in-order successor of that node in the BST.
    The successor of a node p is the node with the smallest key greater than p.val .

参考

但是入参不是一个TreeNode,而是某个value X。如果存在X的TreeNode,返回该 node。不然X的下一个successor。