CS-OA cs-vo Faang

北美starup intern VO record

两轮面试,大概题目如下。
Certainly, here's a refined text-based description of the tasks depicted in the images:

Task 1: Binary Tree Ancestor

Given a binary tree where each node has three properties: left, right, and parents, determine the lowest common ancestor of two nodes. The binary tree nodes are labeled with uppercase letters 'A' through 'I'. For example, if the input nodes are 'H' and 'E', the expected output would be node 'B', which is the lowest common ancestor of the given nodes in the tree.

Task 2: Element Frequency

Given an array of integers and an integer 'k', return the elements that appear most frequently in the array. The return value should be an array containing these elements in any order. The given 'k' represents the number of frequent elements to be returned. Here are some cases:

  • Given the array [1,1,1,2,2,3] and k = 2, the function should return [1,2], as '1' and '2' are the most frequent elements.
  • Given the array [1,1,1,1] and k = 1, the function should return [1], since '1' is the most frequent element.
  • Given the array [1,2,3,2,3] and k = 2, the function should return [2,3], as these are the most frequent elements.
  • Given the array [1,2,3,4] and k = 2, the function should return [1,2], which are among the most frequent elements, given that all elements appear with the same frequency.

代面试,面试辅助,OA代做请联系我们

Leave a Reply

Your email address will not be published. Required fields are marked *