Infrastructure Software Engineer Interview Questions | Glassdoor

Find jobs for Infrastructure Software Engineer

Infrastructure Software Engineer Interview Questions

24

Infrastructure software engineer interview questions shared by candidates

Top Interview Questions

Sort: RelevancePopular Date

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 Answers

Correct 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; }

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 Answers

How would you check if a binary tree is balanced?

1 Answer

Past experience, Main programming language, A tricky Programming Problem to solve

What part of Facebook's infrastructure interests you? What would you like to work on?

Graph search, dynamic programming, binary search trees, arrays, designing a product release.

1 Answer

1. Coding Assessment: Given a file containing keys and values, how would you fetch a value for a key efficiently.

Given a input string and a dictionary, find the longest substring that also appear in the dictionary. each subset need to retain the original order of the characters. what's the efficiency of the solution ?

1 Answer