Infrastructure Software Engineer Interview Questions | Glassdoor

Infrastructure Software Engineer Interview Questions

24

Infrastructure software engineer interview questions shared by candidates

Top Interview Questions

Sort: RelevancePopular Date

Aug 5, 2012
 Write a function that takes 2 arguments: a binary tree and an integer n, it should return the n-th element in the inorder traversal of the binary tree.7 AnswersCorrect answer should be something like this: int FindNthElement(Node *node, int &n) { if (node->Left && n > 0) { k = FindNthElement(node->left, n); if (n == 0) return k; } if (n == 0) return node->value; else if (n > 0 && node->right) { k = FindNthElement(node->right, n); if (n == 0) return k; else return -1; } }int findNthElementByInorder(Node *node, int &n) { if (node == null) return -1; findNthElementByInorder(node->left, n); if (n == 0) return node-> value; else n--; findNthElementByInorder(node->right, n); }Seems it should be something like this, get the to bottom and start counting up from there. int start(Node *node, int &n) { int element = 0; if (node == null) return -1; return findElementIndex(node, element, n); } int findElementIndex(Node *node, int &currentNumber, int findNumber) { if(node->left != null ) { int result = findElementIndex(node->left, currentNumber, findNumber); if(result != -1) return result; } if(node->right != null ) { int result = findElementIndex(node->right, currentNumber, findNumber); if(result != -1) return result; } currentNumber++; if(currentNumber == findNumber) return node->value; else return -1; }Show More Responses//Assumption is that the node values are not negative. //If the tree has less than n nodes, -1 will be returned. int findNthElementByInorder(Node *node, int &n) { if ((node != null) && (n > 0)) { findNthElemetnByInorder(node>left, n); n--; //Count the current node findNthElemetnByInorder(node>right, n); return node->value; } else return -1; }def nth_inorder_node(treeNode, counter) # Check left node if treeNode.left rv = nth_inorder_node(treeNode.left, counter) return rv if rv end # Check current node counter.value -= 1 puts "counter: #{counter.value} \t node: #{treeNode.data}".green return treeNode.data if counter.value == 0 # Check right node if treeNode.right rv = nth_inorder_node(treeNode.right, counter) return rv if rv end return nil endint nthelement(Node node, int n){ int ret; if( node.left != null) { ret = nthelement(node.left, n); if(ret != -1) return ret; } n --; if(n ==0) return node.data; if(node.right != null) { ret = nthelement(node.right, n); if(ret!= -1) return ret; } return -1; }int [] results; int count = 0; int returnNthElement(Node rootNode, int element) { fillArray(rootNode); return results[element]; } void fillArray(Node node) { if (node == null) { return null; } if (node.left == null && node.right == null) { count++; results[count] = node; return; } fillArray(node.left); count ++; results[count] = node; fillArray(node.right); }

Software Engineer (Infrastructure) at Schrodinger was asked...

Dec 12, 2012
 If a large sequence of commits are in the main (master) branch of a git repository and only a subset are desired for a new branch, how would you create that new branch?2 AnswersOne could create the branch and then do a virtual octopus merge of the various change logs from the master branch that are desired, or use patch mode to iteratively extract and apply each commit from the master branch into the new branch.Git Cherry-pick or rebase might do the same as well

Software Engineer (Infrastructure) at Schrodinger was asked...

Dec 12, 2012
 How would you check if a binary tree is balanced?1 AnswerPseudocode was used to show a pre-order depth-first search traversal (recursive), but other answers are possible.

Mar 23, 2016
 Past experience, Main programming language, A tricky Programming Problem to solveBe the first to answer this question

May 20, 2015
 What part of Facebook's infrastructure interests you? What would you like to work on?Be the first to answer this question

Dec 10, 2016
 Graph search, dynamic programming, binary search trees, arrays, designing a product release.1 AnswerHi, Thank you for sharing your interview experience. As a small team of ex-Google employees, we have recently launched interviewjoy.com, a career consultancy community, where you can make money by sharing your interview experiences/insights with other job candidates. The information you have about this interview can be very valuable! Posting an interview consultancy service is totally free & anonymous and users already started making money on the website. You are kindly invited to interviewjoy.com to check it out.

Jan 9, 2017
 Lists, multiple while loops, sequence and countsBe the first to answer this question

Software Engineer, Infrastructure at Pandora Media was asked...

Apr 1, 2015
 1. Coding Assessment: Given a file containing keys and values, how would you fetch a value for a key efficiently.Be the first to answer this question