Backend Developer Interview Questions
- 1of 1 vote
AnswerFor two string a, b, their distance is defined as the number of positions at which the corresponding character are different.
- ajay.raj March 31, 2018 in United States
Now you can swap characters at any two locations once, and ask how to swap to make the distance the smallest.| Report Duplicate | Flag | PURGE
Amazon Backend Developer - 0of 0 votes
AnswerA coffee machine has three buttons (S, M, L). After pressing each button, the coffee machine will flow out of a range of coffee [s1, s2], [m1, m2], [l1, l2], but the outflow of coffee The amount is random. There is a cup with a total capacity of c2. There is a tick c1 on the cup. If the amount of coffee is [c1, c2], it is considered full.
- ajay.raj March 28, 2018 in United States
After asking for a series of button operations, can the coffee be filled in [c1, c2] but not overflow?| Report Duplicate | Flag | PURGE
Amazon Backend Developer - 0of 0 votes
AnswersInput like method stack trace: "main, start", "foo, start", foo, end", "bar, start", "bar end", "main, end", "main2, start", "main2, end"
Output String, such as the following format, to indicate the order in which the method was called and the hierarchy
- ajay.raj March 28, 2018 in United Statesmain Foo Bar main2
| Report Duplicate | Flag | PURGE
Amazon Backend Developer - 0of 0 votes
Answersturns the following format string into a tree: node has keys, values, and subtrees.
- ajay.raj March 23, 2018 in United States
For example, the first key is node1 and the value is ‘aaaa’
<node1>aaaaa<node2>bbbbb</node2><node3>cccc</node3><node4>dddd</node4></node1>| Report Duplicate | Flag | PURGE
Amazon Backend Developer - 0of 0 votes
Answersfind longest common suffix of two linked list.
- ajay.raj March 18, 2018 in United States| Report Duplicate | Flag | PURGE
Amazon Backend Developer - 0of 0 votes
AnswersGive a 0/1 matrix to find and remove the islands. Assume that the boundaries of the matrix are 1
- ajay.raj March 15, 2018 in United States
The definition of islands is surrounded by 0
The simplest example is
enter:
111111
100001
100101
100001
111111
Output:
111111
100001
100001
100001
111111| Report Duplicate | Flag | PURGE
Amazon Backend Developer - 0of 0 votes
AnswersWrite a hash function so that a string and its reverse get the same return value
- ajay.raj March 15, 2018 in United States
Hash(‘banana’) == hash(‘ananab’)
Hash(‘banana’) == hash(‘banana’)
Hash(‘banana’) != hash(‘banaaa’)| Report Duplicate | Flag | PURGE
Amazon Backend Developer - 0of 0 votes
Answersx={a,b,c}, y={p,q}, z={r,s}
- ajay.raj March 10, 2018 in United States
Define a
Operation, x * y * z = {{a,p,r},{a,p,s},{a,q,r},{a,q,s}......{c,q s}}
Is to output all the results in the order of each subset, implementing a class iterator that has Next() and hasNext() methods| Report Duplicate | Flag | PURGE
Amazon Backend Developer - 0of 0 votes
AnswersGive a tree-like graph that lets you find the maximum length from the leaf node to the leaf node. The input is an array of edges.
- ajay.raj March 10, 2018 in United States| Report Duplicate | Flag | PURGE
Amazon Backend Developer - -1of 1 vote
AnswersTo determine whether two people have kinship, all data structures need their own definition
- ajay.raj March 08, 2018 in United States| Report Duplicate | Flag | PURGE
Amazon Backend Developer - 0of 0 votes
AnswerGiven an integer n (say somewhere between 100 and 1000), you want to generate a random binary tree having exactly n nodes. You are only interested in the structure of the tree. Each structurally unique tree should ideally have the same chance of being generated.
- ajay.raj March 07, 2018 in United States| Report Duplicate | Flag | PURGE
Amazon Backend Developer - 0of 0 votes
AnswersGiven k numbers as strings. The numbers may be very large (may not fit in long long int), the task is to find sum of these k numbers.
- ajay.raj March 06, 2018 in United States
Example
S1 = “100”
S2 = “10”
S3 = “1”
Return “111”
public string addNumbers(String[] nums){
}| Report Duplicate | Flag | PURGE
Amazon Backend Developer - 0of 0 votes
AnswersThe problem is to count all the possible paths from any points to bottom right of a mXn matrix with the constraints that from each cell you can either move only to right or down
- ajay.raj March 03, 2018 in United States| Report Duplicate | Flag | PURGE
Amazon Backend Developer - 0of 0 votes
AnswerFind the final states of a n-nary tree
- ajay.raj March 02, 2018 in United States
each node has three states, 0,1,2.
Require that if all child nodes are 2,
The parent node is also 2.
All child nodes are 0, the parent node is 0, and the rest are all 1s.| Report Duplicate | Flag | PURGE
Amazon Backend Developer - 0of 0 votes
AnswersGiven two functions, start (id, start_time), stop (id, time),
- ajay.raj March 02, 2018 in United States
Respectively, to the id assignment start and end time, gave a bunch of such operations (to ensure that the operation start small id first appeared,
And each id last have start_time and stop_time), press the start order to print the corresponding id, start_time, stop_time,
Requirements of space complexity as small as possible,
e.g., start (1, 1), start (2, 2), stop (2, 3), start (3, 4), stop
The print order is (1,1,6), (2,3,2), (3,4,5) # (id, start_time, end_time).| Report Duplicate | Flag | PURGE
Amazon Backend Developer - 0of 0 votes
AnswerTo several bus lines, each line is a two-way line, such as:
- ajay.raj March 01, 2018 in United States
0: A <-> B <-> D
1: C <-> D
After writing the map, give you a start and end, let me find the path through the least station.| Report Duplicate | Flag | PURGE
Amazon Backend Developer - 0of 0 votes
AnswerOutput the second index corresponding to the first one, requiring output only if there is only one match, and false if there is more than one pair
- ajay.raj March 01, 2018 in United States
a b c d e f g a b -> [0,1]
a b b c, a b c -> False| Report Duplicate | Flag | PURGE
Amazon Backend Developer - 0of 0 votes
AnswersCheck if characters of a given string can be swaped to form target string
- ajay.raj March 01, 2018 in United States
ab : ba true
ac : ab false| Report Duplicate | Flag | PURGE
Amazon Backend Developer - 0of 0 votes
Answers1 \ 2 - 3 \ / 4 | 5 - 8 | / 7 For the undirected graph, the LCS is 2,3,4,5, so how can we find it? For a undirected graph, find the Longest Consecutive Sequence
/**
- ajay.raj March 01, 2018 in United States
* Definition for undirected graph.
* class UndirectedGraphNode {
* int label;
* List<UndirectedGraphNode> neighbors;
* UndirectedGraphNode(int x) { label = x; neighbors = new ArrayList<UndirectedGraphNode>(); }
* };
*/
public class Solution {
public List<Integer> longestGraph(List<UndirectedGraphNode> nodes) {
}
}| Report Duplicate | Flag | PURGE
Amazon Backend Developer - 0of 0 votes
Answerscheck if there are two subarrays in an array are identical
- ajay.raj March 01, 2018 in United States| Report Duplicate | Flag | PURGE
Google Backend Developer - 0of 0 votes
Answerscomparison of two strings if they are the same, use o(1) space
- ajay.raj March 01, 2018 in United States
abc \ b is equal to ab
abc \ ca equals abcA
\ b = backspace
\ c = CapsLock| Report Duplicate | Flag | PURGE
Google Backend Developer - 0of 0 votes
Answerconvert Prefix to Postfix using recursion
- ajay.raj March 01, 2018 in United States
+ * A B / C D -> A B * C D / +| Report Duplicate | Flag | PURGE
Google Backend Developer - 0of 0 votes
AnswersGiven the below input and output and asked to write in Java.
- sarunreddy82 February 22, 2018 in United States
Example 1)
input : {1,2,3,4, &, 12,13,14,15}
output : {15,14,13,12,1,2,3,4}
Example 2 )
input : {33,34,&,55,63}
output : {63,55,33,34}
Assumption : '&' will always be in the middle.| Report Duplicate | Flag | PURGE
xyz Backend Developer Arrays - -1of 1 vote
AnswersFind if the shorter string is a subsequence of the longer string
- ajay.raj February 16, 2018 in United States
Output the second index corresponding to the first one, requiring output only If there is only one match, and false if there is more than one pair
a b c d e f g, a b -> [0,1]
a b b c, ab c -> False| Report Duplicate | Flag | PURGE
Google Backend Developer - -1of 1 vote
AnswerTo several bus lines, each line is a two-way line, such as:
- ajay.raj February 16, 2018 in United States
0: A <-> B <-> D
1: C <-> D
give you a start and end, find the path through the least station. followup
Asked the least transfer case| Report Duplicate | Flag | PURGE
Google Backend Developer - 0of 0 votes
Answers
- ajay.raj February 01, 2018 in United StatesMatrix conversion problem. For example, give a matrix a: 1, b: 2. b: 2, c: 3 Then converted into a, b, c 1, 2, . ., 2,3
| Report Duplicate | Flag | PURGE
Google Backend Developer - 0of 0 votes
AnswerIn the range of 0-n, return all the numbers that in the reverse can be mistaken for another number. E.g. 18 -> 81. The corner case is not counting the same number, such as 101 and not 0 at the end of the figure such as 60 (because 09 is not 9)
- ajay.raj January 23, 2018 in United States
Public List<Integer> getNum(int n)| Report Duplicate | Flag | PURGE
Google Backend Developer - 0of 0 votes
AnswerGive a binary tree, each node has an extra information, that is, how many children he has,
Find the kth node val in the inorder transversal ,
Followup how to insert a node, such that this newly added node become the Nth node of the inorder binary tree's traversal
- ajay.raj January 21, 2018 in United Statesclass TreeNode{ int val; int NumberOfchildren; TreeNode left; TreeNode right; public TreeNode(int val){ this.val = val; } } public static int findKthOfInorder(TreeNode root, int k) {
| Report Duplicate | Flag | PURGE
Google Backend Developer - 0of 0 votes
AnswersGive a string, finds all duplicate substrings of length k
- ajay.raj January 13, 2018 in United States| Report Duplicate | Flag | PURGE
Google Backend Developer - -3of 3 votes
AnswerGive an array such as [1,2,2,2,0] every time you can jump 1 to a [i] step,
- ajay.raj January 13, 2018 in United States
If you can jump to 0, return false
if you go out to return true| Report Duplicate | Flag | PURGE
Google Backend Developer