Facebook/Meta | Phone Screen | New Grad | Binary Tree + Backtrack problem
Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2022-01-04Added By Anonymous
Source: Link
Company: Meta (Facebook)
Role: unknown
Stage: Phone Screen
Location: unknown
Year: unknown
**1)** Get average of all elements in binary search tree which are in range [low, high] inclusive. 6 / \\ 4 8 / \ / \\ 3 2 7 9 / 2 Input: [3, 10] => 6 because (42/7) Input: [2, 5] => 3.5 because (14/4) **2)** 123456789 = 100 Using standard integer arithmetic operators +, -, what are those different solutions you can find by inserting the operators between some digits? EX) * -1+2-3+4+5+6+78+9 * 123-45-67+89 # 100 Similar to https://leetcode.com/problems/expression-add-operators/ Good luck! Only managed to get a solution to the 1st one, second one walked through what I thought would be the solution and managed to only roughly implement it.
Role: unknown
Stage: Phone Screen
Location: unknown
Year: unknown
**1)** Get average of all elements in binary search tree which are in range [low, high] inclusive. 6 / \\ 4 8 / \ / \\ 3 2 7 9 / 2 Input: [3, 10] => 6 because (42/7) Input: [2, 5] => 3.5 because (14/4) **2)** 123456789 = 100 Using standard integer arithmetic operators +, -, what are those different solutions you can find by inserting the operators between some digits? EX) * -1+2-3+4+5+6+78+9 * 123-45-67+89 # 100 Similar to https://leetcode.com/problems/expression-add-operators/ Good luck! Only managed to get a solution to the 1st one, second one walked through what I thought would be the solution and managed to only roughly implement it.