Backend Developer Interview Questions
- 0of 0 votes
AnswerA group of people goes to eat together, each pay is not the same, then after they go home later, they each use mutual transfer so that everyone pay the same money.
- ajay.raj January 13, 2018 in United States
input is an int array that each person pay, Ask who the amount of money was paid when the transfer was done, such as B -> A $ 3, C -> A $ 1.| Report Duplicate | Flag | PURGE
Google Backend Developer - 0of 0 votes
Answersfind the last index of the last duplicate number in a sorted array
- ajay.raj January 11, 2018 in United States
ex
input: 1,2,5,6,6,7,9
output: 4(index)| Report Duplicate | Flag | PURGE
Google Backend Developer - 0of 0 votes
AnswersGiven a string, check if it is can be reorganized such that the same char is not next to each other, If possible, output a possible result
- ajay.raj January 11, 2018 in United States
example
input: google
one possible output: gogole| Report Duplicate | Flag | PURGE
Google Backend Developer - 0of 0 votes
AnswersGiven a binary tree, print the path that has the maximum path sum.
For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child connections. The path must contain at least one node and does not need to go through the root. the node val may be negative one
- ajay.raj December 02, 2017 in United StatesFor example: Given the below binary tree, 1 / \ 2 3 Return 2-1-3. -1 / \ -2 3 \ -1 Return 3. public List<Integer> findMaxPath(TreeNode root){ } /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */
| Report Duplicate | Flag | PURGE
Facebook Backend Developer - 0of 0 votes
Answersgive a list of cities a to city b the price of air tickets for example
- ajay.raj November 25, 2017 in United States
a b 100 $
b c 200 $
e f 200 $
...
Now let you from city x to city y, you cannot transfer more than twice between the two city, find the cheap flight from x to y, follow up print out the flight| Report Duplicate | Flag | PURGE
Google Backend Developer - 0of 0 votes
AnswersGive a list of the company's Mergers and Acquisitions relationships, for example
- ajay.raj November 16, 2017 in United States
[
["baidu", "ofo"],
["mobike", "alibaba"],
]
Said baidu acquired ofo, mobike acquired Alibaba.
Seeking the longest of a M & A chain. No cycle| Report Duplicate | Flag | PURGE
Google Backend Developer - 9of 9 votes
AnswersDeveloping Java game
- stallapp November 03, 2017 in United States
creating a RESTful service using which players can play a simple game described
below.
The game should have the following rules:
• The player has an infinite amount of coins.
• The player bets 10 coins to play a normal game round.
• In any round (free or normal), the player has a 30% chance of winning back 20 coins.
• In any round (free or normal), the player also has a 10% chance of triggering a free round where
the player does not have to pay for bet. The free round works in the same way as a normal round except
it costs 0 coins. The free round should follow immediately after the normal round.
• The player can both win coins and free round at the same time.| Report Duplicate | Flag | PURGE
Amazon Backend Developer Java - 0of 0 votes
AnswersGiven a remote having 0-9 digits, plus button (to increase channel), minus (to decrease) and previous channel button (to go to previous channel). We were given 2 numbers stating start and end channel number and an array having various channel numbers. The task was to go to all channel numbers given in array with minimum number of clicks.
- neer.1304 August 31, 2017 in United States| Report Duplicate | Flag | PURGE
Goldman Sachs Backend Developer Algorithm - 3of 3 votes
AnswersApple phone interview
- aonecoding July 23, 2017 in United States
Given an API to find all IPv4 addresses in a log file, find all IPs that occurred only once.
Follow-up: What if the log comes from a data stream.
Follow-up: If the machine has 4GB RAM, is there going to be a problem?| Report Duplicate | Flag | PURGE
Apple Backend Developer Algorithm - 0of 0 votes
Answerwrite bash code to determine if the first number in the string is greater than 1000
- ajay.raj July 22, 2017 in United States
STR="count ------- 43952 (1 rows)"| Report Duplicate | Flag | PURGE
Amazon Backend Developer - 0of 0 votes
AnswerThere is 3D space, limited with a cube, with edge=2000.
- John.Ackerman.jb May 17, 2017 in United States
The center of coordinate system is point (0; 0; 0), so the maximum/minimal coordinate value is 1000/-1000.
There are 10000 points generated with discrete uniform distribution inside of K spheres, located in the cube.
Radius (R) of each sphere is 250.
Centers of spheres are located at the distance of not less than 2*R.
It is required to determine which point related to which sphere.
Input: array of 10000 structures, like:
struct Point {
int number;
int x;
int y;
int z;
}
where number is unique id of the point, x,y,z - it's coordinates.
Output:
array of 10000 structures, like:
struct Point {
int number;
int cluster_id;
}
where cluster_id is unique cluster id of a sphere that point belongs to.
Initially I considered a following solution:
1) Find Euclidian distance for each point from center of coordinates (0;0;0) to point's coordinates.
2) Sort this array of distances in descending order.
3) Get the point from the sorted array of distances and put in a new Set of Cluster Maximals.
4) Compare following point from the array to each value from the Set of Cluster Maximals (initially 1 value).
If it's Euclidian distance less than or equal to 2*R, then
mark this point as belonging to Kth cluster (range=1..N), otherwise add the point to the Set of Cluster Maximals.
5) Repeat step 4.
Two concerns I have:
1) There is an issue that my algorithm would work only in case if Claster Maximals are located on the surface of the spheres.
2) Plus, according to the task requirements, there could be the case when 2 spheres can have 1 and only common point.
I think in case if point belongs to 2 spheres, it is ok to mark it with cluster_id of any of these 2 shperes.
Could you please provide a proper solution to the task?| Report Duplicate | Flag | PURGE
Amazon Backend Developer - 1of 3 votes
AnswersGiven array of length n, having element 0 to n-1.
- DATA April 11, 2017 in United States
you are allowed to swap adjacent element only if Absolute difference of two element is equal to 1.
Is it possible to sort array.
If yes print sorted output.| Report Duplicate | Flag | PURGE
Yahoo Backend Developer Arrays Data Structures Math & Computation Online Test - -1of 1 vote
Answer--
- edboon06 April 06, 2017 in United States| Report Duplicate | Flag | PURGE
Backend Developer Algorithm - 0of 0 votes
Answers1) Given a file containing lines of chars, find if it contains "aaaaab\naaaaa" string pattern. Need to return true only if contains the EXACT pattern specified (observe the new line character).
- xankar March 10, 2017 in United States
2) How do you differentiate between actual new line and the new line character?
3) what if the file is way too big to bring it all in memory?| Report Duplicate | Flag | PURGE
Dropbox Backend Developer 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 - 0of 0 votes
Answers
- xankar February 26, 2017 in United Statesimport java.time.Duration; import java.time.LocalTime; import java.util.List; import java.util.Map; // Your goal is to write business logic for a very simple Restaurant booking system // You are encouraged to refactor exisiting code, create other classes, write helper methods etc // You also need to make sure that the implementation works correctly class Reservation { public String name; public int partySize; public LocalTime startTime; } class Table { public int tableNumber; public int maxPartySize; } class Restaurant { public List<Table> tables; public LocalTime openTime; public LocalTime closeTime; public Map<Integer, Duration> reservationDurationsPerPartySize; // Returns a Table if Reservation could be booked, null otherwise // Booking rules: // 1) Reservation could be made only when the Restaurant is open. // 2) Only one Reservation can be seatted a Table at any time. // 3) Reservation can be seatted only at a Table of the same or a bigger size. // 4) Reservation should stay on the same Table for the whole Duration. // 5) Reservation Duration is determined by PartySize. public Table bookReservation(Reservation reservation) { //TODO: } }
| Report Duplicate | Flag | PURGE
Opentable Backend Developer Algorithm Data Structures Java Problem Solving - 0of 0 votes
AnswersGiven set of N number of points/Co-ordinates[(x1,y1),(x2,y2), (x3,y3), (x4,y4), (x5,y5), etc] find if any of them form square.
- xankar February 26, 2017 in United States| Report Duplicate | Flag | PURGE
Pure Storage Backend Developer Algorithm Data Structures Java - 0of 0 votes
Answers1) Finish writing the below method: bookReservation(Reservation reservation)
2) You are free to add, modify, etc the following classes and method
- xankar February 18, 2017 in United Statesimport java.time.Duration; import java.time.LocalTime; import java.util.List; import java.util.Map; // Your goal is to write business logic for a very simple Restaurant booking system // You are encouraged to refactor exisiting code, create other classes, write helper methods etc // You also need to make sure that the implementation works correctly class Reservation { public String name; public int partySize; public LocalTime startTime; } class Table { public int tableNumber; public int maxPartySize; } class Restaurant { public List<Table> tables; public LocalTime openTime; public LocalTime closeTime; public Map<Integer, Duration> reservationDurationsPerPartySize; // Returns a Table if Reservation could be booked, null otherwise // Booking rules: // 1) Reservation could be made only when the Restaurant is open. // 2) Only one Reservation can be seatted a Table at any time. // 3) Reservation can be seatted only at a Table of the same or a bigger size. // 4) Reservation should stay on the same Table for the whole Duration. // 5) Reservation Duration is determined by PartySize. public Table bookReservation(Reservation reservation) { //fill this method }
| Report Duplicate | Flag | PURGE
Google Backend Developer Software Design - 2of 2 votes
AnswersPrint the longest path from root to leaf in a Binary tree (Basically the nodes that lie on the height path).
- abhinavg.stack January 08, 2017 in United States| Report Duplicate | Flag | PURGE
Amazon Backend Developer Data Structures - 0of 0 votes
Answer2.{{ Query the sum of all the data values in a given rectangle (x1,y1) ~(x2, y2).
- mannurujava January 07, 2017 in United States
int querySum(int x1, int y1, int x2, y2) {}}}| Report Duplicate | Flag | PURGE
Yahoo Backend Developer Algorithm - 0of 0 votes
Answer{{Given a two dimensional grid that stores data as integers with the size of N*M, implement write and query functions which supports:
- mannurujava January 07, 2017 in United States
1. Write the given value to designated coordination (x, y).
void write(int value, int x, int y) {}
}}| Report Duplicate | Flag | PURGE
Yahoo Backend Developer Algorithm - 0of 0 votes
Answershttp://www.buycakeonline.in/corporate-cakes.php
- codeingets September 23, 2016 in India for web developer| Report Duplicate | Flag | PURGE
Boomerang Commerce Backend Developer - 0of 0 votes
AnswersGiven an array of integers where size of array can be large. Find if it is possible to make all elements of given array equal by multiplying elements with one or more input prime numbers.
- claud.qualityinfo July 31, 2016 in India
e.g.
arr = 50, 200
primes to use = 2, 3
so possible by multiplying 50 by 2 * 2
e.g.
arr = 3, 5
primes to use = 7
not possible| Report Duplicate | Flag | PURGE
Adobe Backend Developer - -3of 3 votes
AnswersGiven a number n.find (l X b) dimension such that it is maximally close .
- ganesh.eng2015 July 30, 2016 in India
E.g:--
12---o/p->4X3 not 6X2
13---o/p->5X3 // as it is close| Report Duplicate | Flag | PURGE
Amazon Backend Developer - 1of 1 vote
Answersgiven a LinkedList like 1->2->3->4->5->6
- ganesh.eng2015 July 30, 2016 in India
Modify it as:
1->6->2->5->3->4| Report Duplicate | Flag | PURGE
Amazon Backend Developer - 0of 0 votes
AnswersYou have table defining meta data for all tables in your system
- abc006 January 22, 2016 in United States for NA
col name | table name | primary key| foreign key|
design a algorithm to generate sql dynamically based on column selection.| Report Duplicate | Flag | PURGE
xyz Backend Developer Algorithm - 0of 0 votes
AnswersUsing the following:
- DOrtiz1011 January 20, 2016 in United States
public static Func<int, int> Y(Func<Func<int, int>, Func<int, int>> f)
{
return x => f(Y(f))(x);
}
Create a Func<int, int> which computes the n-th fibonacci number using only anonymous lambdas.| Report Duplicate | Flag | PURGE
Jet Backend Developer Functional Programming