Software development engineer Interview Questions | Glassdoor.ie

# Software development engineer Interview Questions

137

software development engineer interview questions shared by candidates

## Top Interview Questions

Sort: RelevancePopular Date

### Software Development Engineer at Amazon was asked...

23 Feb 2011
 difference between "hashing a string" and "encrypting a string". Then: is it possible to find two elements for which the hash is the same?3 Answersyou can't "go back" from a hash. You can go back from encription if you know the secret (say password, private key, whatever). Second question: yes but then you have a problem.1. Encryption uses a secret key while hashing does not require any key. Moreover, hash is one-way but encryption can be reversed by a decryption operation. 2. Yes, that's called hash collision, which although a low probability occurrence, does exist.Decryption of encrypted string is possible. But we cannot say same thing for hashing. Because hash is one way operation. Q2:Low probability, it is possible using brute force

### Software Development Engineer I Intern at Amazon was asked...

3 Oct 2015
 Given an array of integers [1,2,3,4]. and target t = 5. Come up with a solution that will print out all the unique pairs in the array that are equal t.3 AnswersFound this very hard, but the interviewer gave subtle hints, and I eventually came up with the idea of using a nested for loop. But I was not completely correct as I had set the inner incrementer to j = 0 instead of j = i+1 .array a=new array(); foreach(int i in a) { if(i==t) { console.writeline(i.toString()); } } //c# code,i am not sure if this is what they whantedpublic class CalculateTuple { /** * @param args */ public static void main(final String[] args) { final int arr[] = { 1, 2, 3, 4 }; final int sum = 5; solution(arr, sum, false); } /** * find possible tuple for provided sum * * @param input * input array * @param expectedSum * expected sum value for the tuple * @param isCommutative * true : (1,2) != (2,1) will give you both tuple
* false : (1,2) == (2,1) are same and give you only (1,2) */ public static void solution(final int input[], final int expectedSum, final boolean isCommutative) { final Map indexedArray = new HashMap(); final Map uniquePair = new HashMap(); final int length = input.length; for (int i = 0; i < length; i++) { indexedArray.put(input[i], i); } int count = 0; for (int i = 0; i < length; i++) { final Integer integer = indexedArray.get(expectedSum - input[i]); if (integer != null && integer != i) { if (isCommutative || (null == uniquePair.get("(" + i + "," + integer + ")") && null == uniquePair.get("(" + integer + "," + i + ")"))) { System.out.println("(" + i + "," + integer + ")"); uniquePair.put("(" + i + "," + integer + ")", "(" + i + "," + integer + ")"); count++; } } } System.out.println("Found " + count); } }

### Software Development Engineer In Test (SDET) at Microsoft was asked...

1 Oct 2015
 Program to check if a "ransom note", has been taken from a particular news paper article. Which meant you were given two arrays of strings, and you had to check if the first array, could have been constructed from the second set2 AnswersNested loop checking each word in the first array against each word in the second until it finds a match, if a match has been found then you remove the word from the second arrayWe can use a hashset to store the elements of the first array and while looping through the second array, remove the element if it is present in the set. Finally if the hash set is empty, first array is constructed from the second. Time complexity is O(n).

### Software Development Engineer In Test (SDET) at Microsoft was asked...

13 Feb 2012
 Given the root of a binary search tree, link all the nodes at the same level, by using an additional Node* level.2 AnswersStart from the root, put all the nodes in a queue, keep track of number of nodes at current level and at next level by counting, dequeue a node from the queue, put its left and right children in the queue by updating your counts, using your counts, connect the nodes at the same level. O(N) in both time and space.Queue size is never larger than half+1 of the node count, just noting. Rough code: Queue q = new Queue(); q.Enqueue(root); int count = 1; int nextCount = 0; T prev = null; while (!q.Empty()) { T cur = q.Dequeue(); if (prev != null) { // doubly-link level siblings prev.rightSibling = cur; cur.leftSibling = prev; } count--; if (count == 0) { // next level count = nextCount; nextCount = 0; prev = null; } else { // same level prev = cur; } if (cur.Left != null) { nextCount++; q.Enqueue(cur.Left); } if (cur.Right != null) { nextCount++; q.Enqueue(cur.Right); } }

### Software Development Engineer II at Microsoft was asked...

24 Mar 2009
 Find exist in maze or prove its non existence.3 AnswersYou need to write a code for finding shortest path in maze. For a recursion use call stack.Keep an structure (array / binari Tree/ hash table) to "remember" if a "node" has been use to avoid loop. Building a graph and nodes to navigate trough the maze and track back on your node until you reach your first node that have no more "start node" or you have found the "exit node" One or more comments have been removed. Please see our Community Guidelines or Terms of Service for more information.

### Software Development Engineer at Amazon was asked...

23 Feb 2011
 Say you have 10K web pages. How do you find all the phone numbers contained in them?1 Answerpython + regexp.

### Software Development Engineer at Amazon was asked...

19 Jul 2017
 Weighted graph traversal algorithms. 1 AnswerDijkstras.

### Software Development Engineer at Amazon was asked...

1 Aug 2017
 They asked me about my professional experience. They want to know about trade-offs and how did I solve it.1 AnswerI answered with a quick review of my professional experience and tell about several problematic situations, and how did I solve it.

### Software Development Engineer at Amazon was asked...

3 May 2019
 Q: Hashmap, Hash collision, Merge 2 sorted Arrays into 1 Sorted array, Implementing weight number generator1 Answerfunc solve() { var ai = 0 var bi = 0 var result = [Int]() while ai * a.count || bi * b.count { guard ai * a.count else { result.append(b[bi]) break } guard bi < b.count else { result.append(a[ai]) break } if a[ai] * b[bi] { result.append(a[ai]) ai += 1 } else { result.append(b[bi]) bi += 1 } } print(result) }

### Software Development Engineer at Amazon was asked...

28 Jan 2019
 Online challenge: 1. Given an array with 2d points, return the N-closest to the origin 2. Given a matrix of integers representing obstacles in an area, find the shortest path to a destination 3. What is the runtime complexity of your solutions1 Answer1. Sort the array (by distance) and return the first N elements 2. Dijkstra
110 of 137 Interview Questions

More