Bloomberg | Phone Interview | New Grad

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2020-09-18Added By Anonymous
Source: Link
Bloomberg | Phone Interview | New Grad Start with self-introduction and some questions related to my resume. Then, 2 coding questions 10 minutes left for asking questions Question 1: Given a number, check if it is a palindrome boolean isPalindrome(int x) { // Your code here } Question 2: Print all accessible nodes inorder public class Node { Node up; Node right; Node down; int value; } // all upper nodes are less than value of that node // all lower nodes are greater than value of that node // all right nodes are greater than value of that node and its lower nodes // the upper node cannot access to the lower node (unidirectional) void printInorderNode(Node node) { // Print all accessible nodes in order } For example 1 ^ | 2 7 10 ^ ^ ^ | | | 3 -> 5 -> 8 -> 11 -> 12 | | | v v v 4 6 9 Calling printInorderNode(3) should print [1,2,3,4,5,6,7,8,9,10,11,12] Calling printInorderNode(5) should print [5,6,7,8,9,10,11,12]
Comments