Software Developer Interview Questions
- 2of 2 votes
AnswersWrite a method to count the number of 2s between 0 and n.*
- xankar May 12, 2016 in United States| Report Duplicate | Flag | PURGE
Amazon Software Developer Coding - 0of 0 votes
AnswersDesign an algorithm to figure out if someone has won in a game of tic-tac-toe.
- xankar May 12, 2016 in United States| Report Duplicate | Flag | PURGE
Amazon Software Developer Coding - 0of 0 votes
AnswersDesign a hashMap in Java. Implement put, get, remove, resize methods.
- xankar May 10, 2016 in United States| Report Duplicate | Flag | PURGE
Uber Software Developer Algorithm - 0of 0 votes
Answers1) Narrate an instance you optimized or improved a software design.
- xankar May 10, 2016 in United States
2) Given a chance how would you re-think some of the design aspects?| Report Duplicate | Flag | PURGE
Uber Software Developer Behavioral - 0of 0 votes
AnswerDesign a Twitter feeds API. How would you actually connect it from a mobile? What happens behind the Twitter network? how do the Trends get published? From where does Twitter get the information for a particular trend(Eg: #Obama, #nfl) and publish it out? What protocol does it use? How do you connect to Twitter API? How does Twitter handle multiple connections?
- xankar May 10, 2016 in United States| Report Duplicate | Flag | PURGE
Uber Software Developer Software Design - 0of 0 votes
Answers1) Describe your most proudest project, least proudest project
- xankar May 10, 2016 in United States
2) Most inpiring teammate, what did he do?
3) Most awesome manager? Why was he so good?| Report Duplicate | Flag | PURGE
Uber Software Developer Behavioral - 0of 0 votes
AnswersGiven a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.
- xankar May 10, 2016 in United States
For example, given
s = "leetcode",
dict = ["leet", "code"].
Return true because "leetcode" can be segmented as "leet code".| Report Duplicate | Flag | PURGE
Uber Software Developer Algorithm - 0of 0 votes
AnswersWrite a function that takes a string representing as value in roman numbers and returns it as an integer.
- joey April 28, 2016 in United StatesImplement the following /** * * romanNumber("III") = 3 * romanNumber("IV") = 4 */ int romanNumber(String roman) { // ... }
| Report Duplicate | Flag | PURGE
Linkedin Software Developer Algorithm - 0of 0 votes
AnswersWrite a function that takes a number and returns the square root
- joey April 28, 2016 in United StatesImplement the following double sqrt(double d) { // ... }
| Report Duplicate | Flag | PURGE
Linkedin Software Developer Algorithm - 0of 0 votes
AnswersGiven a stream of characters (e.g. acacabcatghhellomvnsdb) and a list of words (e.g. ["aca","cat","hello","world"] ) find and display count of each and every word once the stream ends.(Like : "aca" : 2 , "cat" : 1 , "hello" : 1 , "world" : 0 ).
- badebhaiyya April 16, 2016 in United States| Report Duplicate | Flag | PURGE
Booking.com Software Developer Algorithm - 8of 8 votes
AnswersYou are given a graph, some edges are black, some are red. Find a spanning tree with one restriction: if we take some node as root, every path from it to some leaf node must consist of alternating red-black-red-black edges. That is, no path from root to leaf must contain sequential black-black edges or red-red edges.
- emb April 12, 2016 in United States
You are guaranteed that such spanning tree exists.| Report Duplicate | Flag | PURGE
Google Software Developer Algorithm - -1of 1 vote
AnswersProvide a function that allow to compare two strings lexicography, having in mind that these words may contain digraphs (two letters together represents a single one i.e in Spanish ch is a single character ).
- urodba April 07, 2016 in United States
This in order to be able to sort a list of words.| Report Duplicate | Flag | PURGE
Google Software Developer Sorting - 0of 0 votes
AnswersThere are N coins with coordinates (x, y) where x >0 and y >0
- emb April 02, 2016 in United States
You start at (0, 0) and you can only do steps of form (dx, dy) where dx >0 and dy > 0
Print the maximum number of coins that you can collect.
Clarification: you can do as many moves as you wish, the point is to collect maximum number of coins. If you are located at position (a, b) you may jump to position (a+dx, b+dy) for all dx > 0 and dy > 0
@krbchd: Your algorithm may output incorrect values. Suppose there are points (5, 7), (5, 8), (5, 9) for y coordinates LIS will output 7, 8, 9, however since these points are on the same x axis, you can choose only one of them.| Report Duplicate | Flag | PURGE
Facebook Software Developer Algorithm - 0of 0 votes
AnswersFind all the customers who spent >2 minutes on Page "XYZ" & purchased
- LoneStarTexxan March 22, 2016 in United States
>2 items of cofffee_X && gave a review of >3
Objects given:
class PageView {
private String URL;
private String customerID;
private Integer timeSpent;}
class Purchase {
private String productID;
private String customerID;
private Integer itemsPurchased;}
class Review {
private String productID;
private String customerID;
private Integer reviewPoints;}| Report Duplicate | Flag | PURGE
Software Developer Data Structures - 1of 1 vote
Answers#define mysizeof(x) (char*)(&x+1)-(char*)(&x)
- jkl March 20, 2016 in India
//why casting is done to char* for mysizeof
// casting it to void also works| Report Duplicate | Flag | PURGE
HCL Software Developer C - 9of 9 votes
AnswersGiven a packed file with 1Tb of 64-bit doubles (first 8 bytes are first double, next 8 bytes are next, etc) find the exact value of median. For simplicity assume the number of doubles is odd.
- emb March 19, 2016 in United States
You can't modify the file and you have only 8Gb of free memory.
Update: you may use no more than two passes through file and your algorithm shouldn't rely on some nature of file - it should work in all cases.| Report Duplicate | Flag | PURGE
Google Software Developer Coding - 0of 0 votes
AnswersGiven an array of numbers, find the longest alternating subsequence. That is, a subsequence [a1, a2, a3, ..., ak] where a1 > a2, a3 < a2, a4 > a3, ... or vice versa (Graphically looks like /\/\/\... or \/\/\/\....
- emb March 19, 2016 in United States| Report Duplicate | Flag | PURGE
Google Software Developer Algorithm - 0of 0 votes
AnswersJack love playing games, Gluttonous snake( an old game in Nokia era) is one of his favorite. However, after playing gluttonous snake so many times, he finally got bored with the game, so he changed the rules:
- mirrorme March 12, 2016 in United States
Rule 1: Write a code to find the Max sum path in a grid (2-D array), with dimension with n rows and m column (1<=n,m<=500)
Rule 2: In the 2D Array, each cell (elements) contains a value v in the array is from (-1<=v<=99999)
Rule 3. You can start from any position of the leftest column (border) of the array to the rightest(border) column of the array to calculate the Max Sum path.
Rule 4. You can move up, right, down, and CAN'T move left, and can visit each element only one time.
Rule 5.If the element is -1, it means the path is blocked, and you can't go through the path (calculate it in the sum), you have to choose other path to calculate the sum.
For example, if a 4*4 array grid
{{-1,3,2,1}
{2,-1,2,4}
{2,2,-1,3}
{4,2,1,2}};
The max sum path is : (from grid[4][0])
4-->up-->2-->left-->2-->down-->2-->left-->
1-->left-->2-->up-->3-->up-->4-->up-->1
and the sum is 4+2+2+2+1+2+3+4+1 =21
Thank you
Here is my code, I am new in Java and there is still lots of improvements
import java.util.*;
public class MainClass {
public static void main(String[] args) {
@SuppressWarnings("resource")
Scanner rowDimension = new Scanner(System.in);
System.out.print("Enter the number of rows: ");
int firstInput = rowDimension.nextInt();
@SuppressWarnings("resource")
Scanner columnDimension = new Scanner(System.in);
System.out.print("Enter the number of columns: ");
int secondInput = columnDimension.nextInt();
//Input two number to generate 2D Array
Integer [][] array = new Integer[firstInput][secondInput];
//The purpose of the array is check the wall (cell value = -1)
boolean [][] visited = new boolean[firstInput][secondInput];
//Use Math.random() to generate the cell of the array
int[][] randomTable = new int[firstInput][secondInput];
for (int row = 0; row < firstInput; row++) {
for (int column = 0; column < secondInput; column++) {
// multiply by 1000000 to get a number between 0 and 99999
randomTable[row][column] = (int)(Math.random() * 1000000 -1);
System.out.print(randomTable[row][column] + " ");
}
System.out.println();
}
//Start form the left-down location of grid
int i = firstInput-1, j = 0;
visited[i][j] = true;
double sum = array[i][j];
while(true)
{
int max = -1;
int maxi = 0, maxj = 0;
//Case1 : choose path: UP
if(i-1 >= 0 && i-1<= firstInput-1 && j>=0 && j<= secondInput-1 && array[i-1][j] != null && array[i-1][j]>max && !visited[i-1][j])
{
max = array[i-1][j];
maxi = i-1;
maxj = j;
}
//Case2 : choose path: Down
if(i+1 >= 0 && i+1<= firstInput-1 && j>=0 && j<= secondInput-1 &&array[i+1][j] != null && array[i+1][j]>max && !visited[i+1][j])
{
max = array[i+1][j];
maxi = i+1;
maxj = j;
}
//Case3 : choose path: Right
if(i >= 0 && i<= firstInput-1 && j+1>=0 && j+1<= secondInput-1 && array[i][j+1] != null && array[i][j+1]>max && !visited[i][j+1])
{
max = array[i][j+1];
maxi = i;
maxj = j+1;
}
i = maxi;
j = maxj;
visited[i][j] = true;
sum += max;
//To the destination : Right-Up location of the grid
if(i == 0 && j == secondInput-1)
break;
}
System.out.println(sum);
}
}| Report Duplicate | Flag | PURGE
TATA Consultancy Services Software Developer Java - 0of 0 votes
AnswersA flipping rule is given as a follows: Consider a series of positive integer. Take three numbers in the series next to each other. On applying the flipping rule to these numbers, the right most number will go to the left most number position and the other two numbers will move one position to the right at the same time. The rule can be applied to any three numbers present next to each in the series and can be applied as many times as needed.
- Info.Dubey March 03, 2016 in India
Given n as the number of element in the original series, elements of the original series and a target series of a numbers, figures out if the target series can be created by flipping numbers of the original number and output the word “POSSIBLE” followed by the number of times the flipping rule has to be applied. In case, the target series cannot be formed, output the word “IMPOSSIBLE”.
Example :
For a series with 4 elements in it, 1 3 4 2 a new series = 4 3 2 1 can be formed by applying flipping rule as follows, From the table below we can say the output is POSSIBLE 3.
Steps
Series
The three Numbers Flipped
Resultant Series
1
1 3 4 2
1 3 4
4 1 3 2
2
4 1 3 2
1 3 2
4 2 1 3
3
4 2 1 3
2 1 3
4 3 2 1
Example input
Example OutPut
4 1 3 4 2 4 3 2 1
POSSIBLE 3
6 1 2 3 4 5 6 6 5 4 3 2 1
IMPOSSIBLE| Report Duplicate | Flag | PURGE
Infosys Software Developer C++ - 0of 0 votes
AnswersYou are given an array of variable length, which contains only following integers: -1, 0, 1.
- kishoredbn March 01, 2016 in United States
Example A[] = {0, 1, 0, 1, 1, -1, 1}
You are also given an integer S.
Write a program with O(n) time that can find out the length of the largest sub-array which sums up to S.
Example, if S = 2, then the length of the largest sub-array in the above array is 6.
If there is no such sub-array that can sum up to S, then output 0.| Report Duplicate | Flag | PURGE
Galatea Associates Software Developer Algorithm - 1of 1 vote
Answerswhich number most unlikely belong to following set of number 9 23 46 75 116
- akash.umang February 27, 2016 in India| Report Duplicate | Flag | PURGE
Adobe Software Developer Puzzle - 0of 0 votes
Answersuse case where only namespaces can only be used in c++
- jkl February 23, 2016 in India| Report Duplicate | Flag | PURGE
Siemens Software Developer - 0of 0 votes
AnswersWrite a program to balance the binary search tree ?
- mithleshtechno February 21, 2016 in United States
with explanation and preferred
C language..| Report Duplicate | Flag | PURGE
TATA Consultancy Services Software Developer - 0of 0 votes
AnswersBinary search inorder traversal asked by Amazon
- Info.Dubey February 20, 2016 in India
struct Node
{
int data;
Node *right.*left,*random
}
Tree should be in-order traversal and random node should keep the in-order transversal path.| Report Duplicate | Flag | PURGE
Amazon Software Developer Data Structures - 0of 0 votes
AnswersAmazon interviewer has told to made a program which print number increment or decrement fashion depend on the user input.
- Info.Dubey February 20, 2016 in India
suppose if user enter "ID" where "I" stands for increment number and "D" stands for decremental number and produced output should be 231. they have given three condition first condition Number should be belongs from 1 to 9.
second condition number should not be duplicate
third number should be least number.
example:
User input "ID"
Number should be 231
if User Input "IDDI"
then output should be 45312
if user input "IID" then output should be 2341| Report Duplicate | Flag | PURGE
Amazon Software Developer - 2of 2 votes
AnswersDefine a function that can detect whether the characters of a string can be shuffled without repeating same characters as one other's neighbors. E.g. :
- fahmida.hamid February 11, 2016 in United States
apple >> alpep, so valid
a >> a, valid
aa >> aa, invalid/impossible
aab >> aba, valid
aaaabbcc >> acabacab, valid
etc.
You do not have to find one representation, just have to detect if it is possible or not!| Report Duplicate | Flag | PURGE
Google Software Developer Algorithm - 3of 3 votes
AnswersCheck if an integer array is arithmetic sequence.
- PS February 08, 2016 in United States
Example: 1, 2, 3, 4, 5, 6, 7, 8 => true
1, 3, 5, 7, 9 => true
Array may not be sorted.| Report Duplicate | Flag | PURGE
Amazon Software Developer Algorithm - 0of 0 votes
AnswerAn Integer array is given,
- chjit99 February 08, 2016 in India
Find the combination of number in the array which satisfies the equation: a to the power b= c.
A number should not be repeated in multiple combination.
1. a and b are adjacent no. in the array.c can be any where in the array.
2.No other array or data structure can be used. However modification of current array is possible.
Define a function which will take array as input and generate a output array (a modification of input array).
Example: Input array: 1 2 3 8 5
out put: 2 3 8 0 0| Report Duplicate | Flag | PURGE
xyz Software Developer - 0of 0 votes
AnswersGiven a 2D array of digits, try to find the occurrence of a given 2D pattern of digits. For example, consider the following 2D matrix:
- kohansey February 04, 2016 in United States
7283455864
6731158619
8988242643
3839505324
9509505813
3843845384
6473530293
7053106601
0834282956
4607924137
Assume we need to look for the following 2D pattern:
950
384
353| Report Duplicate | Flag | PURGE
Amazon Software Developer Matrix - 0of 0 votes
AnswersHi.For the online assessment test - Debugging , which programming languages code snippet I can expect?Thank you !
- Priti January 23, 2016 in United States| Report Duplicate | Flag | PURGE
Amazon Software Developer Debugging