Recent Interview Questions
- 2of 2 votes
AnswersGiven a pre-order traversal, construct a binary search tree in O(n) time.
- neer.1304 September 04, 2017 in United States| Report Duplicate | Flag | PURGE
Microsoft SDE-2 Algorithm - 2of 2 votes
Answers2.1 career discussion
- aonecoding July 15, 2017 in United States
2.2 divide two numbers with no / or %| Report Duplicate | Flag | PURGE
Facebook Software Engineer Algorithm - 2of 2 votes
AnswersEvaluate the value of an expression given in Reverse Polish notation
- varun.venu September 22, 2015 in United States| Report Duplicate | Flag | PURGE
Linkedin Senior Software Development Engineer Coding - 2of 2 votes
AnswersGiven a linked list: 5 -> 4 -> 3 -> 2 -> 1, produce the following output: 4 -> 2 -> 0 -> 2 -> 1 by substracting the 1st node with nth node, the 2nd with nth -1 node, etc... Only apply the stated action on the first half of the list
- NL May 11, 2014 in United States| Report Duplicate | Flag | PURGE
Software Engineer / Developer Coding - 2of 2 votes
AnswersSetup:
- at March 24, 2014 in United States
Assume primitive Facebook. FB has Members.
class Member {
String name;
String email;
List<Member> friends;
}
Question A:
Code printSocialGraph(Member m). Direct friends of m are Level 1 friends. Friends of friends are level 2 friends.....and so on
Print level 1 friends first. Then print level 2 friends....and so on| Report Duplicate | Flag | PURGE
Amazon - 2of 2 votes
AnswersWrite down the top ten testcases for sanity check of Templerun app in android based mobile. Testcases should appear in priority order?
- tester February 26, 2014 in India| Report Duplicate | Flag | PURGE
Amazon Testing / Quality Assurance Testing - 2of 2 votes
AnswersHow will you implement run-time polymorphism in C? There are two structs. There is a common function receiving only one argument(only one). The function should accept both base struct and derived struct objects and do corresponding actions. i.e if base struct object is passed, do base struct's task and vice versa
- chid1989 January 07, 2014 in United States| Report Duplicate | Flag | PURGE
NVIDIA Intern C++ - 2of 2 votes
AnswersGiven a 'friendship' graph, how would you generate friend suggestions for people, and how would you distribute the data across machines?
- nr June 04, 2013 in United States for google map| Report Duplicate | Flag | PURGE
Google SDE1 Algorithm - 2of 2 votes
AnswersQ: If I give you a new book, and ask you to create the index which is found at the end of the book, how will you do it.
- Aditya April 14, 2013 in United States
A: I said for constant addition time of words (and page numbers) in the data structure, we can use Hashmap or TRIE. But since output has to be in alphabetic order, we will use a Trie DS, where at the end of each word, we simple store a list of page numbers.| Report Duplicate | Flag | PURGE
Bloomberg LP Financial Software Developer Data Structures - 2of 2 votes
AnswersWhat is the difference between a computers heap and it's stack?
- brighama March 29, 2013 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Computer Architecture & Low Level - 2of 2 votes
AnswersThere is an machine which can process any kind of fruit and produce packaged boxes … write test cases for that
- vik February 24, 2013 in United States for Internet Explorer| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Testing - 2of 2 votes
AnswersWrite a program to find out if the binary tree is balance or not. The tree is balance if the difference between the
- india.tp.1976 January 21, 2012 in United States
left node and right node is equal or less than 1. The above considition is applicable for subtree too..
If tree do not have any child, its height will be zero.
What is the order of above program| Report Duplicate | Flag | PURGE
IBM Accountant Algorithm - 2of 2 votes
AnswersHe showed me a game on his android phone. some sort of maze. There is ball at starting point ball can move in 4 direction at max if there is no wall. End point is hole you need to write code to solve this problem. Idea is convert it into graph and do the DFS to find the path from start to end.
- MaYanK July 29, 2010| Report Duplicate | Flag | PURGE
Google Developer Program Engineer Algorithm - 2of 2 votes
AnswersGiven an infinite chessboard, find minimum no. of steps for a knight to reach from the origin to (x, y).
- neer.1304 July 03, 2019 in United States
Extension A list of forbidden coordinates are introduced where knight can’t reach. Handle this in your code. Make sure the infinite loop is handled since the board is infinite.| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 2of 2 votes
AnswersGive the following input, output if the array is sorted according to the ordering array given. Return true or false.
- releb February 28, 2018 in United States
Input:
words = ['cc', 'cb', 'bb', 'ac']
ordering = ['c', 'b', 'a']
Output: True
Input:
words = ['cc', 'cb', 'bb', 'ac']
[bb cb cc ac]
ordering = ['b', 'c', 'a']
Output: False| Report Duplicate | Flag | PURGE
Facebook Software Engineer - 2of 2 votes
AnswersPartition given string in such manner that i'th substring is sum of (i-1)'th and (i-2)'nd substring. If such partition not possible then return empty arrayList.
- nileshpatil1212 February 05, 2018 in India
eg.
1) given "1111223" then return ["1", "11", "12", "23"]
2) given "1111213" then return ["11", "1", "12", "13"]
3) given "11121114" then return []| Report Duplicate | Flag | PURGE
Amazon Software Developer - 2of 2 votes
AnswersRound1
- aonecoding August 09, 2017 in United States
Find if two people in a family tree are blood-related.
Round2
Given some nodes in a singly linked list, how many groups of consecutively connected nodes there is.
For linked list
0->1->2->3->4->5->6,
given nodes 1, 3, 5, 6
there are 3 groups [1], [3], and [5, 6].| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 2of 2 votes
AnswersGoogle on-site June
- aonecoding August 03, 2017 in United States
Round 1
Leetcode 10
Round 2
Select a random point uniformly within a rectangle, (The side of rectangle is parallel to the x/ y grid).
Follow-up: Given multiple non-overlapped rectangles on the 2D grid, uniformly select a random point from the rectangles.| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 2of 2 votes
Answers/**
* Given a nested list of integers, returns the sum of all integers in the list weighted by their REVERSED depth.
* For example, given the list {{1,1},2,{1,1}} the deepest level is 2. Thus the function should return 8 (four 1's with weight 1, one 2 with weight 2)
* Given the list {1,{4,{6}}} the function should return 17 (one 1 with weight 3, one 4 with weight 2, and one 6 with weight 1)
- xankar March 03, 2017 in United States*/ public int reverseDepthSum (List<NestedInteger> input) { // implementation here }
| Report Duplicate | Flag | PURGE
Linkedin Backend Developer Algorithm - 2of 2 votes
AnswersWrite a function that receives a position in 2 dimensional (x,y) array, which was initially initialized with 'o' (signals "water"), the function changes the value/state of that position to 'x' (signals "land") and returns the number of isles in the board.
- vesh February 08, 2017 in Irland
For example, for 3x3 board, it will initially look like the following:
o o o
o o o
o o o
After calling the function with the position (1,2), the board will look like the following:
o o x
o o o
o o o
and the functions returns 1
An isle is defined as 'x' surrounded horizontally and vertically with 'o'
In the following board there is only one isle
o o o
o x x
o x o| Report Duplicate | Flag | PURGE
Google Site Reliability Engineer Algorithm - 2of 2 votes
AnswersYou are given a board with N rows and M columns. In this board you have to place exactly 1 bishop in each row. There are also some obstacles in some of the cells where you can't place a bishop. Bishops can only move diagonally but they can't go to a cell where there is any obstacle. Two bishops can attack each other if one of them can move to the cell of the other bishop. Now you have to count the number of ways that you can place bishops in the board.
- amnesiac September 12, 2015 in United States
Note: Two bishops can attack each other if one of them can move to the cell of the other bishop in a single move without passing any obstacles.
Input Format
The first line of the input contains two integers N and M. The following N lines contain M characters each, the description of the board. Each cell of the board is either '.' which means that this cell is free or '*' which means that this cell contains an obstacle.
Constraints
1<=N,M<=10
Output Format
Print only one integer representing the number of ways to put exactly one bishop in each row such that no two bishops attack each other.
Sample Input
3 3
..*
.**
.*.
Sample Output
2| Report Duplicate | Flag | PURGE
- 2of 2 votes
Answers1. A server is getting streams of numbers from TCP IP. Write code to get minima/maxima for every 60sec. - The interviewer was looking for code with multithreading as you can perform print of minima/maxima for 60 sec interval and at same time do comparison.
- Tom Walker June 09, 2015 in United States
2. If the stream can't be handled by one server and now there are multiple servers how would you calculate minima/maxima? To calculate what optimizations would you do.
3. If now you need to find 10 largest and 10 smallest elements how would you do?| Report Duplicate | Flag | PURGE
Expedia Software Developer Front End Web Development - 2of 2 votes
AnswersDesign an HTTP downloader that caches results and doesn't block execution (i.e., enables simultaneous downloads).
- diegum June 06, 2014 in United States for iOS| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer Object Oriented Design - 2of 2 votes
AnswersInterview gave towers of Honai with 4 pegs namely: source, helper1, helper2, destination.
- poorna.chandra.akp April 28, 2014 in India
What are the minimum number of steps to move N number of discs from source to destination.
he was looking for a recursive function which defines the number of moves required for N and the minimum value for that function.| Report Duplicate | Flag | PURGE
Flipkart SDE-2 Algorithm - 2of 2 votes
AnswersYou have a 100 coins laying flat on a table, each with a head side and a tail side. 10 of them are heads up, 90 are tails up. You can't feel, see or in any other way find out which side is up. Split the coins into two piles such that there are the same number of heads in each pile.
- Gaile January 31, 2014 in United States| Report Duplicate | Flag | PURGE
Apple SDE1 - 2of 2 votes
AnswersPrint array in spiral
- Shyam November 23, 2013 in India for Kindle
123
894
765
Output: 123456789| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Algorithm - 2of 2 votes
AnswersHow the java calculate the size for Hashset and what would b the output. Jsutify your answer with Java point of view..
- techieDeep May 29, 2013 in United States
import java.util.HashSet;
public class HashTest {
private String str;
public HashTest(String str) {
this.str = str;
}
@Override
public String toString() {
return str;
}
@Override
public int hashCode() {
return this.str.hashCode();
}
public static void main(String args[]) {
HashTest h1 = new HashTest("1");
HashTest h2 = new HashTest("1");
String s1 = new String("2");
String s2 = new String("2");
HashSet<Object> hs = new HashSet<Object>();
hs.add(h1);
hs.add(h2);
hs.add(s1);
hs.add(s2);
System.out.print(hs.size());
}
}| Report Duplicate | Flag | PURGE
Adobe SDE1 - 2of 2 votes
AnswersWrite all possible test cases for SMS (Short Messaging Service) on a mobile device.
- Raghunath April 11, 2013 in India for Kindle| Report Duplicate | Flag | PURGE
Amazon Testing / Quality Assurance Testing - 2of 2 votes
AnswersDesign a graph problem, given an function getFriend(int user) which returns all the users 1st degree friends, write a function to check:
- ikf4 May 01, 2021 in India
1. whether two users are first-level, second-level and third-level connections
2. function that outputs a users 2nd degree and 3rd degree friends| Report Duplicate | Flag | PURGE
Google Software Engineer