Senior software development engineer Interview Questions in Las Vegas, NV, US

991

Senior Software Development Engineer interview questions shared by candidates

Top Interview Questions

Sort: Relevance|Popular|Date
Amazon
Senior Software Development Engineer was asked...29 September 2014

1) Given a array and a sum, find all the pairs in the array which have the given sum. 2) Given a BST you need to identify swapped nodes

6 Answers

1) Iterate through the list and create a hashmap of an integer to integer where 1st value is the value in the array and second is the repetition (takes O(n) time). Now iterate through this hashmap and for every value (say a), and assume x is the sum map.get(x-a) * map.get(a) but make sure map.get(x-a) is not null or map.get(x-a) != map.get(a) (if it is then apply combinations as a total amount as C(map.get(a), 2) ). You could either count this or print up to the interviewer, and this iteration will take O(n) worst case. So the algorithm will be linear. There are less efficient ways too such as sort the list (n lgn) and then have an initial loop (n) and then apply quick select(lgn) which would make O(n lgn) again so overall complexity would be O(n lgn). Worst one is brute force where you could have two nested loops and compare every value which would take O(n^2) time 2) needs some clarifications such as how do we understand a node is "swapped"? Less

I exp to call me

PSEUDO CODE FOR QUESTION ONE THAT SHALL NOT LIST UNIQUE PAIRS BUT SHALL INCLUDE INVERSE PAIRS TOO... Let Array be ARY of 'n' elements and given Sum be SUM. Let the result be RESULT string. Begin. Initialize RESULT string; Let i and j be integer variables; for (initial value of i=0, while i < or = n, increment i by 1) { for ( initial value j = 0, while j < or = n, increment j by 1) { if ((i not equal to j) and ( if (ARY[i] + ARY[j] ) is equal to SUM)) RESULT = RESULT + " ("+ ARY[i] + ","+ ARY[j] +" )" } } Print RESULT; End. Less

Show More Responses
Kony

Given a string, konylabsinterview write a program to return bool if a given pattern matches.pattern example - kon*lab*terview*

5 Answers

public class Test{ public static void main(String args[]){ String Str = new String("konylabsinterview"); System.out.print("Return Value :" ); System.out.println(Str.matches("kon(.*)lab(.*)terview(.*)")); } } Less

Use KMP

Hi, Please see if you can provide the details of the question posed in the context of binary search tree. Thanks. Less

Show More Responses
Amazon

Give a 2D rectangular array represented as a 1D arrary in row-major form, rotate the array by 90 degrees

4 Answers

I came up with a solution where you transpose the array and then exchange the colums. But this is very inefficient. Does anyone have a better solution. Less

Let n be the number of rows and m be the number of columns. Make m stacks of (n-1) size, Less

Let n be the number of rows and m be the number of columns. Make m stacks of (n-1) size and iterate through your "2D" array by successively pushing entries through stacks: eg. (entry i is being pushed in stack ~(i mod m)) when i reaches m x (n-1) pop stack and overwrite entries in the "2D" array from the beginning until empty + i'th entry then go to the next stack. Repeat until done. this should run in m x (n-1) + m x n = m x (2n +1) and uses m x (n-1) x (data entry mem size) extra memory during the run. If you want to use less memory, it gets a whole lot more complicated but won't be as quick. Less

Show More Responses
Careem

One of the question was on Designing & Code a TTL Cache with some modifications

4 Answers

TTL Cache

TTL Cache

cream

Show More Responses
Microsoft

Probability of a knight making a valid move on NxN matrix in m steps.

4 Answers

Buddy, I think you thinking a bit too complicatedly. A knight on a chess board only has 8 legal moves. and if it is anywhere closer than being atleast 2 boxes from the border it will be less than 8. just take a input of all the pieces on the NxN matrix. check these 8 positions and calculate the probability Less

Given in the description above.

Guess what , I got almost the same question on my first interview with Google , and I was applying as a new college grad ....i also can up with a DP solution with O(64m) .... btw can you provide the link to the solution you came across ...?? Less

Show More Responses
Zillow

Write a function that detects the first non-repeating character in a char array, and do so with only a single pass over the array.

3 Answers

Hhh

Just use an int arr of size 256 and a queue

There's quite an extended back and forth in actual interviews for questions like this, so nothing quite like real practice. The Prepfully Zillow Senior Software Development Engineer experts have actually worked in this role, so they're able to do an honest-to-God accurate mock, which really puts you through the paces. prepfully.com/practice-interviews Less

Amazon

How many balls can u place into a box out of 25 balls.Not mentioned anthing more than this...how funny is this :)

3 Answers

I think you were expected to get details by asking questions which is expected from a experienced professional(Requirement gathering). Less

all of them

Hypothetical question

Amazon

Write a function/method with this signature: bool MyFunc(string term, string input) {} The method should return true if the search term is found in the input string, even when there are other characters in between. Examples: "aba", "bbbbabbxxxxxxbb" returns false "aba", "bbbbabbxxxxxxab" returns true Basically, do I see an 'a', then 'b', then another 'a' before I run off the end of the input string?

3 Answers

static boolean MyFunc(String term, String input) { int j=0; for(int i=0;i Less

static boolean MyFunc(String term, String input) { int j=0; for(int i=0;i Less

complexity: computational=O(n) (actually, Theta(n)); disk=O(1). public class MyClass { public static void main(String args[]) { System.out.println("Found = " + myFunc("aba","bbbbbbabbbbbxxxxxab")); System.out.println("Found = " + myFunc("aba","bbbbbbababbbbxxxxxab")); System.out.println("Found = " + myFunc("aba","bbbbbbbbbbabbbbbbbbbbbbbbbaba")); // add @Tests } public static boolean myFunc(String term, String input) { boolean found=false; int j=0,i=0; // Edge cases if(term.length()>input.length()) return false; if(term.length()==0) return true; // O(n): scanning the input while(i Less

ServiceNow

Coding round : If A,B,C are 3 non-zero digits(1-9), find all combinations of A,B,C such that AB * AB = CAB.

3 Answers

AB * AB = CAB and not ABC

Just solve it mathematically by considering all possible digits that satisfy this condition at units digit first and then the solution will automatically fall in place. Less

If i understood the problem correctly: Repetition is allowed Sol: If you see AB*AB = ABC -> (AB*AB)/AB=C; ->AB = C; so basically you need to find out those values whose multiplication is equal to C and C can not be more than 9: So you will find these : (1,1)(1,2).....(1,9) (2,1)(2,2)(2,3)(2,4), (3,1)(3,2)(3,3),(4,1),(4,2),(5,1)(6,1)(7,1)(8,1)(91) Less

Rubicon Project

Write a program to remove vowels from a given string

2 Answers

class Vowels{ public static void main(String args[]){ String input = "abcdefgh"; String vowels = "aeiou"; String output = ""; for(int i=0;i Less

write a program to define whether an array is sorted or not

Viewing 1 - 10 of 991 Interview Questions