Software Engineer / Developer Interview Questions
- 4of 4 votes
AnswersDesign and implement the constructor for the minesweeper game that takes in the dimension of the field and number of mines as input
- JSDUDE September 24, 2015 in United States| Report Duplicate | Flag | PURGE
Tableau Software Engineer / Developer Algorithm Object Oriented Design - 4of 4 votes
AnswersYou have written a memory manager and after using it your coworker complains that he is facing severe issues of fragmentation. What could be the reason(s) and how can you fix it
- vik October 04, 2013 in United States| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer Computer Architecture & Low Level Debugging Operating System - 4of 0 votes
AnswersGiven location of huge number of points (you decide the data structure to represent them). Write a function that returns the number of points that are with distance D of a given point P.
- SG October 15, 2008
Write function, complete with what data structures, function signature etc.| Report Duplicate | Flag | PURGE
National Instruments Software Engineer / Developer Large Scale Computing - 4of 0 votes
AnswersI was given a simple code which had strUppr() function and asked to find the bugs in the code.
- Stud January 16, 2009
Bugs were related to following topics
1. Return value of the function was pointer to an array which is wrong.
2. A while loop with length of a string was written. There length of string was not considered till the end of the array.
3. A range of characters were compared. If (x>a && x<z). Here the bug is that a and z will not be considered.| Report Duplicate | Flag | PURGE
VMWare Inc Software Engineer / Developer C - 3of 13 votes
AnswersIn a language, there are only 4 characters ‘h’, ‘i’,’r’, ‘e’. and we have to write a function which takes a string as input and returns whether the given input string is a “valid word” or not.
- hugakkahuga October 23, 2013 in India
Definition of valid word :
1. A given word is a valid word if it is of the form h^n i^n r^n e^n where n >=1. (eg: hhiirree)
2. Valid words has concatenation property i.e. if w1 and w2 are valid words w1w2 is also a valid word.| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 3of 11 votes
AnswersGiven a binary representation of an integer say 15 as 1111, find the maximum longest continous sequence of 0s. The twist is it needs to be done in log N. I could think of O(N) solution. but couldn't go for log(N).
- TapeRecordia October 24, 2013 in United States
For example. 10000101
the answer should be 4, because there are 4 continouos zeroes.| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 3of 7 votes
AnswersConsider a hotel where the guest is checked in and check out. Find a day when the maximum number of guests stay in a hotel.
- itsvks February 01, 2017 in Netherlands
example:
Input :
[
{check-in : 1, check-out 4},
{check-in : 2, check-out 5},
{check-in : 10, check-out 12},
{check-in : 5, check-out 9},
{check-in : 5, check-out 12}
]
Output : 5| Report Duplicate | Flag | PURGE
Booking.com Software Engineer / Developer Algorithm - 3of 5 votes
AnswersGiven two singly linked list, find if they are intersecting. Do this in single iteration. Also find the intersecting node in O(n) time and O(1) space. By intersection I mean intersection by reference not by value
- dm December 05, 2012 in India| Report Duplicate | Flag | PURGE
Amazon Microsoft Software Engineer / Developer Linked Lists - 3of 5 votes
AnswersYou're given an array of integers(eg [3,4,7,1,2,9,8]) Find the index of values that satisfy A+B = C + D, where A,B,C & D are integers values in the array.
- omair.ahmed08 October 09, 2014 in United States
Eg: Given [3,4,7,1,2,9,8] array
The following
3+7 = 1+ 9 satisfies A+B=C+D
so print (0,2,3,5)| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer Algorithm Arrays Data Structures - 3of 5 votes
AnswersPrint all palindromes of size greater than equal to 3 of a given string. (DP)
- amnesiac February 15, 2014 in United States| Report Duplicate | Flag | PURGE
Epic Systems Software Engineer / Developer Algorithm - 3of 5 votes
AnswersGiven a set of busy time intervals of two people as in a calendar, find the free time intervals of both the people so as to arrange a new meeting
- Phoenix December 02, 2014 in United States
input: increasing sequence of pair of numbers
per1: (1,5) (10, 14) (19,20) (27,30)
per2: (3,5) (12,15) (18, 21) (23, 24)
ouput: (6,9) (16,17) (22,22) (25,26)| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 3of 5 votes
AnswersA string is called sstring if it consists of lowercase english letters and no two of its consecutive characters are the same.
- priteshpathak15 July 29, 2013 in India
You are given string s of length n. Calculate the number of sstrings of length that are not lexicographically greater than s.
Input format
The only line of input contains the string s. It's length is not greater than 100.
All characters of input are lowercase english letters.
Output format:
Print the answer of test modulo 1009 to the only line of output.
Sample input:
bcd
Sample output:
653| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer Front-end Software Engineer Algorithm - 3of 5 votes
AnswersThere is a village in which parent prefer to have at least 1 boy. So they keep doing child until they get their first boy and then they stop doing children. What is ratio of girl/boy in such town after infinite years.
- shivam.s.kalra March 13, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Automata - 3of 5 votes
AnswersI was asked to design a meeting scheduler, just like in the Microsoft outlook calendar or the gmail calendar. I proposed that I will create an array of 48 for each day. Every 30 min representing the array entry.
- Bevan March 01, 2013 in United States for AWS
I have to make sure that the next appointment does not collide with a previous meeting.
My solution works fine but it wastes too much memory.
Can anyone please tell me how do I find a better solution to detect collision for meetings.
I don't know all the meetings at the beginning. They will be added randomly later.
Thanks,| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer System Design - 3of 5 votes
Answersgiven a dictionary of wrods,find the pair of word with following property:
- haozyname November 19, 2013 in china
1,the two word don't have same letter.
2,the multiple of the two word's length is maximum.
i give a simple O(n*n*k)(k is the average length of word) method.but i think there will be better one .| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 3of 5 votes
AnswersYou're given a machine (Let's say a sprinkler). The machine is controlled with a software component that has UI. The user can set different parameters in the UI. for example : 'speed' : 120 'pressure' : 30
- GeorgyBoy December 30, 2013 in Israel
Change the system so it will accept an arithmetical expression in the UI. The expression can contain constants, parameters (e.g 'speed') and operators.| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Object Oriented Design - 3of 5 votes
AnswersGiven two sorted linked lists, how can you combine them into one big sorted list? Do not create additional nodes.
- kredible November 12, 2017 in Singapore| Report Duplicate | Flag | PURGE
Goldman Sachs Software Engineer / Developer Java - 3of 3 votes
AnswersQ1.- Written exam (Amazon, Bangalore)
- Nitin Gupta May 12, 2012 in India
Given a singly link list and a number 'K', swap the Kth node from the start with the Kth node from the last. Check all the edge cases.
Sample Input: 1->2->3->4->5->6->7->8 and K = 3
Sample Output : 1->2->6->4->5->3->7->8
Sample Input: 1->2->3->4->5->6->7->8 and K = 10
Sample Output: print error "LIST IS OF LESSER SIZE".| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm C C# C++ Coding Data Structures Java Linked Lists - 3of 3 votes
AnswersGiven a circular single linked list.Write a program that deletes every kth node until only one node is left.
- Aashish August 01, 2012 in India
After kth node is deleted, start the procedure from (k+1)th node.
e.g.list is 1->2->3->4->5->1
k=3
1. You are at 1, delete 3.
List is: 1->2->4->5->1
2. You are at 4, delete 1
List is: 2->4->5->2
3. You are at 2,delete 5
List is: 2->4->2
4. You are at 2, delete 2
List is: 4
Return 4.
How efficient you can do it?| Report Duplicate | Flag | PURGE
Amazon Google Software Engineer / Developer Algorithm - 3of 3 votes
AnswersGiven a value and a binary search tree.
- vodangkhoa April 24, 2007
Print all the paths(if there exists more than one) which sum up to that value. It can be any path in the tree. It doesn't have to be from the root.| Report Duplicate | Flag | PURGE
Microsoft Yahoo Software Engineer / Developer Trees and Graphs Coding Algorithm - 3of 3 votes
AnswersWrite a program to determine whether n/2 distintinctve pairs can be formed from given n integers where n is even and each pair's sum is divisible by given k. Numbers cannot be repeated in the pairs, that means only you can form total n/2 pairs.
- topjobsncr October 09, 2012 in India| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 3of 3 votes
AnswersGiven a length n, return the number of strings of length n that can be made up of the letters 'a', 'b', and 'c', where there can only be a maximum of 1 'b's and can only have up to two consecutive 'c's
- djway August 10, 2016 in United States for None
Example:
findStrings(3) returns 19
since the possible combinations are: aaa,aab,aac,aba,abc,aca,acb,baa,bac,bca,caa,cab,cac,cba,cbc,acc,bcc,cca,ccb
and the invalid combinations are:
abb,bab,bba,bbb,bbc,bcb,cbb,ccc| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 3of 3 votes
AnswersGiven a string pattern of 0s, 1s, and ?s (wildcards), generate all 0-1 strings that match this pattern.
- lsecrease June 25, 2013 in United States
e.g. 1?00?101 -> [10000101, 10001101, 11000101, 11001101].
You can generate the strings in any order that suits you.| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer - 3of 3 votes
AnswersFind the k'th largest element in a binary search tree. Write code for
- jtr.hkcr March 03, 2013 in United Statesstruct Node { int val; struct Node *left; struct Node *right; } Node; Node * kth_largest(Node *root, unsigned int k);
| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer Coding - 3of 3 votes
AnswersGiven an array A[], find (i, j) such that A[i] < A[j] and (j - i) is maximum.
- lyra_vega November 09, 2011 in -| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 3of 3 votes
AnswersYou are given an array of N elements.arrange array in such a way that sum of any cunsucative k numbers are divisible
- dilip kasana October 25, 2012 in India
by NUM.if not possible print -1.(it may possible that there are many solution possible then return any one)
For example:
N=6
k=3
NUM=63
array={80,17,90,82,27,19}
Answer:{19,17,27,82,80,90}
any 3 cunsucative no. like (27+82+80)%63=0
another solution={27,19,17,90,82,80}
may be a hint :try to group all no.'s in mod NUM map and use vector and map.| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer Algorithm - 3of 3 votes
AnswersGiven a bst and a group of numbers g, check whether all the elements of g occur in the same path.
- thebiker925 September 12, 2013 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - 3of 3 votes
AnswersCount smaller elements on right side
- NaiveCoder February 27, 2012 in India
eg : [4,12,5,6,1,34,3,2]
o/p [3,5,3,3,0,2,1,0]| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer - 3of 3 votes
AnswersImplement LookAndSay function. For example, first, let user input a number, say 1. Then, the function will generate the next 10 numbers which satisfy this condition:
- Kevin February 22, 2013 in United States
1, 11,21,1211,111221,312211...
explanation: first number 1, second number is one 1, so 11. Third number is two 1(previous number), so 21. next number one 2 one 1, so 1211 and so on...| Report Duplicate | Flag | PURGE
Epic Systems Software Engineer / Developer Algorithm