BlackRock–styleSoftware EngineerSoftware EngineerQuestion #51
Find the least common ancestor of two given nodes in an N-ary tree.
Build Your Approach
State the assumptions, try a simple case, then work toward a general solution. Check the result and explain how it changes if an assumption changes.
Try the free diagnostic with worked solutions →Get Free Interview Prep Resources
More BlackRock–Style Software Engineer Questions
Write an algorithm that sorts a hashmap.Given a string, determine if it is a palindrome, ignoring any characters that are not alphabetic.1) Reverse a number: Given an integer input, output its digits in reverse order. For example, input: 9966, output: 6699.
2) Word count in a string: Given a string, return the count of each unique word. For example, input: 'The lovely lady is looking lovely as all lady look lovely' output: The: 1, lovely: 3, lady: 2, is: 1, looking: 1, as: 1, all: 1, look: 1.
3) Swap two numbers without using a temporary variable: Given two numbers, swap their values without using a third variable. For example, input: a = 10, b = 20. Output: a = 20, b = 10.Solve the intersection of two linked lists from scratch, including implementing the linked list data structure. Start with a brute-force approach and optimize it. Also, explain the difference between arrays and linked lists.Given a singly linked list, find and return the value of the middle node.
Practice the Reasoning Behind the Answer
Bring your target roles and interview timeline to a free quant consult. Discuss your preparation priorities and how Quant Blueprint’s lessons, practice and mock interviews can help.
Book a Free Quant ConsultYour goals · your preparation · your next steps