# Questions d'entretiens - Infrastructure engineer

# 1 k

Questions d'entretien pour Infrastructure Engineer partagées par les candidats## Principales questions d'entretien

### 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 réponses↳

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 end Moins

↳

int 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; } Moins

↳

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); } Moins

### Questions about multi-threads, which I do not have much experience with. After telling them lack of familiarity on the subject, the interviews understand me and ask other questions instead.

3 réponses↳

I just had a phone interview last week, for the same position. When did u gt the reply back from them? thanks Moins

↳

I got the interview on Friday, and received email the following Monday. For coop it should not take too long. Moins

↳

I had interview on 19th July phone interview and didnot receive any reply yet. Could you please elaborate your process and did you get the coop ? Moins

### Given 2 very large numbers, each of which is so large it can only be represented as an array of integers, write a function to multiply them.

3 réponses↳

This is similar to implementing add, subtract or multiply functions. A good way to do this is use the same mechanism as we do in high school on paper i.e. you have two arrays. Put one as multiplier and the other as multiplicant. Take the right most digit of multiplier, and multiply with last digit of multiplicant, assign the right into start of result (we either reverse result in the end or we assign it in the end of result ensuring result array's size can accommodate number of digits that result from the multiplication. So we have two nested loops, outer one going through each digit of multiplier and inner one going through each of multiplicant. There are special things to cater 1. Carry result of each multiplication to the next. 2. As in standard multiplication each next digit of multiplier results in as many digits of result for e.g. when multiplying 778 with 64 there is one row of results obtained when 4 is multiplied with each of 7,7 and 8 and another row when the same is done with 6. So either we store all these rows first and add corresponding indexes latter or we keep adding them into the final array as we go (without storing them separately) Moins

↳

const unsigned MULTIPLY_BASE = 10; void multiplyLittleEndian(const vector &a, const vector &b, vector &r) { r.assign(a.size()+b.size(), 0); unsigned ri=0; for(unsigned ai=0; ai Moins

↳

I just coded this too out of curiosity since i only coded big integer + and - in university which was like 6 years ago. So thought of making sure i was right. Here is the function and sample main call. One thing i only found while debugging that two possibilities of carry exist 1. When simply the result of multiplying two numbers 2. When adding a result into existing array. I missed 2 in my implementation at first and only discovered this through testing. Now it's resolved and working. void multiply(int a[], int b[], int sa, int sb) { int sr = sa+sb; int *r = new int[sr]; int res_indx = sr-1; memset(r,0, sr * sizeof(int)); //for(int i=0; i=0; mul--) { int c_indx = res_indx; int carry = 0; for(int mcnt=sb-1; mcnt>=0; mcnt--) { int m = b[mcnt] * a[mul] + carry; int sum = r[c_indx] + (m%10); r[c_indx--] = sum%10; carry = sum/10 + m/10; // two possibilities of carry one in the m and the other in sum if(mcnt == 0) r[c_indx] += carry; // copy the carry digit for the last operand } res_indx--; // X.. moving starting index one column back in each iteration } for(int i=0; i Moins

### Ask one algorithm problem.

2 réponses↳

I am not sure if I can say it to others. It is about string operation. First, find the rules of the operation, and then realize them. Moins

↳

Hi, Can you please share the question?

### What resources do linux cgroups manage?

2 réponses↳

resources. cpu, etc. thats how docker implements limits.

↳

In these sorts of interviews you really need to drill down and understand what the interviewer is looking for. A good way to simulate a real interview experience is to do a mock with one of the Docker Senior Infrastructure/Site Reliability Engineer experts on Prepfully, rated super strongly on TrustPilot... prepfully.com/practice-interviews Moins

### Go through some text, pull out the most common words

2 réponses↳

Creating a for loop w/ nested conditionals as needed

↳

It's essential to demonstrate that you can really go deep... there are plenty of followup questions and (sometimes tangential) angles to explore. There's a lot of Infrastructure Engineer experts who've worked at Anaplan, who provide this sort of practice through mock interviews. There's a whole list of them curated on Prepfully. prepfully.com/practice-interviews Moins

### Coding Question: A buys food for $100 shares among B, C, D and A. B buys groceries for $50 shares among C & D. Print how much each owes in format: A owes $x, B owes $y etc.

2 réponses↳

It was quite simple, the interviewer just wanted to print in a particular format. I was thinking of writing a function which takes any given input but that was not the case. The expectation is that you think of how the input should look like, ex, dict . It was not clear what they are testing given such a trivial objective. Moins

↳

The key in these questions is to cover the fundamentals, and be ready for the back-and-forth with the interviewer. Might be worth doing a mock interview with one of the Coinbase or ex-Coinbase Infrastructure Engineer experts on Prepfully? They give real-world practice and guidance, which is pretty helpful. prepfully.com/practice-interviews Moins

### 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 réponses↳

One 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. Moins

↳

Git Cherry-pick or rebase might do the same as well