Senior Software Engineer Interview Questions | Glassdoor.co.uk

# Senior Software Engineer Interview Questions

658

Senior software engineer interview questions shared by candidates

## Top Interview Questions

Sort: RelevancePopular Date

30 Jun 2014

9 Sep 2015
 Except experience related questions I was asked coding question and I was supposed to write the solution to the problem in any programming language in a simple web-based code editor. The question was: given and array of positive integers and another integer find whether there is a consecutive range in the array, so that the sum of integers in the range is equal to the given number. They put an emphasis on delivering working, efficient solution. In my opinion this kind of interview requires a thorough preparation. 5 AnswersEfficient solution you say? Its easy to do it in O(N^2) but I think you mean the O(N*logN) solution. It took me about 5-10 minutes to come up with m, but I am not sure I would be able to write the full source code for this solution in a short period of time. If you did it - then thumbs up man!Two answers, 2nd is O(n) {code} boolean findSum (int[] a, int index, int n) { if (n == 0) return true; if (index > a.size) return false; for (int i = index; i n) sum -= a[sp++]; } return false; } {code}Corrected a bug in solutions 2 abShow more responsesCorrected a bug in solution 2 above: boolean findSum (int[] a, int n) { int sum = 0, sp = 0; for (int i = 0; i n) { sum -= a[sp]; if (sp < i) { sp++; i--; // this is because i increments for each loop continue; } } sum += a[i]; if (sum == n) return true; } return false; }public static void findSum(List A, int k){ int runningSum = 0, fast = 0, slow = 0; while(fast k && slow <= fast) { runningSum -= A.get(slow++); } if(runningSum == k){ System.out.println(slow + " : " + (fast-1)); break; } } }

4 Jun 2015
 Find Kth minimum node in a binary tree and suggest a complexity5 Answers-- Convert the binary tree into a MinHeap binary tree from the nodes -- delete K nodes from the MinHeap binary tree. Complexity : Time required to construct the Min heap by an optimized way: n Time required to delete K nodes from the binary tree = O(K log n) Total complexity : O(n + K log n) Another solution: -- parse the whole tree and find and store the node with the minumum value and delete that node. -- repeat the exercise for K times and the value found in K th parse is the intended value Total complexity : O(Kn)Supposing a BST, where the Node struct is expanded with "int size" which defines the size of its subtree included itself: public Node fintMinimum(Node root, int k) { if (root == null) return null; if (k = k) { return findMinimum(root.left, k); } return findMinimum(root.right, k-(root.left.size+1)); } }Show more responsesConvert the bin tree into a BST [O(n)]. Traverse k elements of the BST [O(k log n)]. Total O(n+k log n).Do a preorder traversal of the tree which is O(n). Then use a pivot quicksort method to find the kth index which is K(log(n)). So the total runtime is O(n +K(log(n))) One or more comments have been removed. Please see our Community Guidelines or Terms of Service for more information.

### Senior Software Engineer at ClearBank was asked...

18 Sep 2018
 Received solution for refactoring.3 Answersrefactored using SOLID principles.I don't think they are really recruiting anyone people. In my case, they just told me that my code did not pass by their internal assessment system. But, they did not say what wrong in my code and why it is failed.Sat the refactoring test and had no feedback. Chased the Job Recruiter who is never at his desk. How strange. Clear Bank are a waste of time, I would keep clear.

### Senior Software Engineer at SAP Concur was asked...

14 Sep 2012
 How will you prevent the code in finally block from executing? The question isn't a very fair one as a good programmer would not write the code in finally block that he/she doesn't want to execute3 Answersif(false)Its just to check logic, finally will not run if system.exit(0) is called.Kind of a trick question. Finally block is always code if the try block is executing, only way to guaranty finally is not called is to not enter the try block.... or pull the plug on the JVM

7 Mar 2016
 Did not go through the interview process.2 Answers1- What was the problem you had so solve in the pair programming exercise? 2- How did you solve the logic question finding the bigger number out of the two using the previous functions?I had not reached the pair programming stage. I could not complete the logic test. For finding Bigger number the code will already be written they would leave spaces for variables and functions, so you will have to use the subtract and add functions to find the biggest number.

### Senior Software Engineer at FP Tech Science was asked...

11 Feb 2018
 you are given a dictionary which contains words hat mat cat hot pot. starting word is hat and ending word is pot you need to find out shortest path..by changing only one character at a time2 Answershat hot hat mat cat hat hot pot. Is this it?First the solution would be a breadth first/depth first approach Why? > Well based on changes in syllable the distance varies. > Trying all connected nodes - connected depends on the number of syllable change. so, one syllable change means connected else not. as per my opinion all the connected nodes would reach to destination if Src and destination are connected even UFS will solve the above problem.

### Senior Software Engineer at Inspired Gaming was asked...

28 Jul 2015
 All questions around multithreading.2 AnswersI was able to answer most of them.How much time it takes to complete the interview procedure? How can we know whether we cleared the first level or not

### Senior Software Engineer at Bloomberg L.P. was asked...

21 Mar 2016
 General questions about C++, templates, some logic based riddles. i.e. Using just a single weight scale and having 9 marbles of equal mass apart from one, which is heavier, how many times do you need to use the weight scale to find the heavier marble?2 Answerstwice.Max Three times

### Senior Software Engineer at Goldman Sachs was asked...

8 May 2010
 Write an algorithm to rotate a node of a binary tree.2 Answersvoid rotateLeft( Node p) { Node r = p.right; p.right = r.left; if (r.left != null) r.left.parent = p; r.parent = p.parent; if (p.parent == null) root = r; else if (p.parent.left == p) p.parent.left = r; else p.parent.right = r; r.left = p; p.parent = r; } void rotateRight(Node p) { Node l = p.left; p.left = l.right; if (l.right != null) l.right.parent = p; l.parent = p.parent; if (p.parent == null) root = l; else if (p.parent.right == p) p.parent.right = l; else p.parent.left = l; l.right = p; p.parent = l; }To help visualise, right rotation is shown below. Consider a given tree: R /\ / \ P C /\ / \ A B Imagine nodes as metal coins suspended by strings (branches). For right rotation: 1. Pick up node P and pull it up so that node R falls down to the right of P. 2. Take B (right child of P) and make it left child of node R. The tree has been right rotated now and looks like this: P /\ / \ A R /\ / \ B C Similar process can be applied to this tree to rotate it left. This time start by pulling up R above P. Hope it helps.
110 of 658 Interview Questions