## Recent Interview Questions

- 1of 1 vote

AnswersAdd two numbers represented as LinkedList (not LeetCode 445 which uses ListNode)

- KelvinLong8897 November 17, 2018 in United States

e.g

inputs: '5'->'6'->'3'

'8'->'4'->'2'

output: '1'->'4'->'0'->'5'

method signature:

LinkedList<Integer> sumList(LinkedList<Integer> l1, LinkedList<Integer> l2)| Report Duplicate | Flag | PURGE

Facebook Android Engineer Algorithm - 1of 1 vote

AnswersYou have two sorted arrays, where each element is an interval. Now, merge the two array, overlapping intervals can be merged as a single one.

- Seetha November 11, 2018 in United States

I/P :

List 1 [1,2] , [3,9]

List 2 [4,5], [8, 10], [11,12]

O/P [1,2], [3,10], [11,12]| Report Duplicate | Flag | PURGE

Facebook Software Developer - 0of 0 votes

AnswersI/P [8, 3, 2, [5, 6, [9]], 6]

- Seetha November 11, 2018 in United States

O/P 8+3+2+2*(5+6+3*(9))+6 => 95| Report Duplicate | Flag | PURGE

Facebook Software Developer Arrays - 0of 0 votes

AnswersWe woild like to encourage passegers to experience the joy of travel using our transit system, therefore we would like to determine the longest path available to advertise the public. Specifically we would like to determine the longest possible trip on the transit sytem that will involve TWO tickets. The destinations must be connected, and all destinations must be unique.

- NoobieCoder3 November 10, 2018 in United States for Python development

You will be provided input in the format of CHI:NYC:719 where CHI is one location, NYC is a connected locatoion and 719 is the distance between the locations.

one line of output should be provided per line of input in the format of 3167:CHI:NYC:LA where 3167 is the distance of the trip, CHI is the starting, NYC is the intermediary location and LA is the final location.

sequence-------input---------------------------output

1------------------CHI:NYC:719----------------NONE

2------------------NYC:LA:2414----------------3133:CHI:NYC:LA

3------------------NYC:SEATTLE:2448------4862:LA:NYC:SEATTLE

4------------------NYC:HAWAII:4924---------7372:HAWAII:NYC:SEATTLE

Note: the start and end cities are lexicographical sorted.| Report Duplicate | Flag | PURGE

Jr. Software Engineer Python - 0of 0 votes

AnswerDesign and implement following . Suppose have 10 resources and 5 threads how do you design so that threads asking for

- pgopan.hai November 10, 2018 in United States

Resources should be done in order. Eg t1 asks for 3 resources, t2 asks for 4 resourcesâ€¦| Report Duplicate | Flag | PURGE

Cadence Inc Principal Software Engineer Threads - 0of 0 votes

AnswersGiven k,n,m. where k is no. of coconuts you initially have. n is the some no. such that if you have >=n coconuts, you becomes stressed otherwise you become normal. m is the no. of shops.You go from 1st shop to m-th shop without skipping any shop. At i-th shop, either you buy Si coconuts or sell Si coconuts. If you are stressed then you must become normal at next shop. If you have less than Si coconuts and you want to sell then you must sell all the coconuts you have. The task is to calculate maximum possible changes of your mood from stressed to normal or vice-versa.

- mendela4cazz November 09, 2018 in India

ie: shop ={100,200,100,1,1} , k=1900 , n=2100 then answer should be 3 as initially mood is happy at first shop we buy 100 coco and total are 2000<n so still happy, at shop 2 coco 2200,now mood is stressed and so| Report Duplicate | Flag | PURGE

Adobe SDE1 - 1of 1 vote

Answersfind all numbers the sum of cube of each digits is the number itself

- Aamir November 09, 2018 in United States

ex:153=1^3+5^3+3^3| Report Duplicate | Flag | PURGE

Facebook Software Engineer Intern - 0of 0 votes

Answerswhat is default pakg in java

- sajidaliit36 November 08, 2018 in United States| Report Duplicate | Flag | PURGE

Nisum Technologies Java Developer - 0of 0 votes

Answersany one can tell what is special modifers in java.

- sajidaliit36 November 08, 2018 in United States| Report Duplicate | Flag | PURGE

Nisum Technologies Java Developer - 0of 0 votes

Answers#include <iostream>

- Rising star November 07, 2018 in India

#define INF 99999

using namespace std;

int calculate(int x,int y)

{

if(x == 1) return y-1;

if(x == y||x == 0||y == 0)

return INF;

return y/x + calculate(y%x,x);

}

int minimum(int N)

{

int minmoves = N-1;

for(int i=2;i<N;i++)

minmoves = min(minmoves,calculate(i,N));

cout<<minmoves<<endl;

}

int main()

{

int N = 1;

cout <<minimum(N);

return 0;

}

Why my code showing correct output with some big integer

Like: 0

1009665443| Report Duplicate | Flag | PURGE

- 1of 1 vote

AnswersGiven a number N, Assume a lexicographical ordered 1 to N numbers.

- keviIma November 06, 2018 in United States

Given array consisting of indices, return the array with numbers at that positions in the lexicographically sorted array of [1 to N].

follow up: Do not use Extra memory.

Expected Runtime = O( N * log k) or O(N)

N = total numbers, (1 to N)

k = Number of queries

Example:

N = 12

lexicographical ordered array = [1,10,11,12,2,3,4,5,6,7,8,9]

Query = [1 , 4]

return = [10, 2]| Report Duplicate | Flag | PURGE

- 1of 1 vote

AnswerThere are A cities numbered from 1 to A.

- keviIma November 06, 2018 in United States

You have already visited M cities, the indices of which are given in an array B of M integers. If a city with index i is visited, you can visit either the city with index i-1 (i >= 2) or the city with index i+1 (i < A) if they are not already visited. Eg: if N = 5 and array M consists of [3, 4], then in the first level of moves, you can either visit 2 or 5. You keep visiting cities in this fashion until all the cities are not visited.

Find the number of ways in which you can visit all the cities modulo 10^9+7

N = 5

Visited = [2, 5]

Number of ways = 6

1 -> 3 -> 4

1 -> 4 -> 3

3 -> 4 -> 1

4 -> 3-> 1

3 -> 1 -> 4

4 -> 1 -> 3| Report Duplicate | Flag | PURGE

- 0of 0 votes

AnswersProgram to find the rank student

- Rising star November 05, 2018 in United States| Report Duplicate | Flag | PURGE

unknown freshers Algorithm - 0of 0 votes

Answers1. Input string s. Check if string s is a valid string with valid brackets

- donkeysnore November 05, 2018 in United States

For example:

(({{}})) is a valid s

{[]} is a valid s

[{[}]] is not valid

2. What kind of tests would you conduct to your program to minimize bugs in your program.

3. On the previous example there is only "()", "{}", and "[]" combination of brackets. If other developers want to add a new kind of brackets such as "<>". What kind of changes would change in your previous program.| Report Duplicate | Flag | PURGE

Bloomberg LP Intern Algorithm - 3of 3 votes

AnswersYou have N toffee packets, each containing different number of toffees. The number of toffees contained in the ith packet is denoted by ci. You need to put these toffee packets in 5 boxes such that each box contains at least one toffee packet, and the maximum number of toffees in a box is minimum.

- parni November 01, 2018 in United States

You can only choose consecutive toffee packets to put in a box.| Report Duplicate | Flag | PURGE

Google - 0of 0 votes

AnswersThe difference between move and forward in C++

- parni November 01, 2018 in United States| Report Duplicate | Flag | PURGE

Google C++ - 0of 0 votes

AnswersWe need to declare variable types in C++.

- parni November 01, 2018 in United States

How does this type declaration change the structure of the code comparing to other languages without type declaration like Python?| Report Duplicate | Flag | PURGE

JP Morgan - 0of 0 votes

AnswersGiven a matrix of 0's and 1's find the smallest number of groups made of 1's, where one group can cover up to two 1's at the same time vertically or horizontally.

- matk100.100 October 31, 2018

01111

11011

00100

The matrix above has 5 of such groups. I've seen similar questions but there the question was about groups of adjacent 1's. Here the groups are limited.

Another question how it would change, if the group wasn't limited to two but to given k - number of 1's vertically or horizontally. The time complexity should be the most efficient.

My idea here i to iterate through rows and when we find a 1, check it's bottom and right neighbour. If it has a right but no bottom, a group is made and we skip the right neighbour as it is already in a group. When the checked 1 has a bottom but no right, we make a group of them and we can skip checking the right as well i think.| Report Duplicate | Flag | PURGE

Algorithm - 0of 0 votes

AnswersPuzzle:

- valipevsr October 30, 2018 in United States

There are 4 similar bottles ,all bottles are filled with milk. In one of the bottle is poisoned. There are 4 rats with you .how many rats are required to find out poisoned bottle?| Report Duplicate | Flag | PURGE

- 0of 0 votes

AnswersThere are 4 similar bottles ,all bottles are filled with milk. In one of the bottle is poisoned. There are 4 rats with you .how many rats are required to find out poisoned bottle?

- valipevsr October 30, 2018 in United States| Report Duplicate | Flag | PURGE

- 0of 0 votes

Answerhow can i apend two array in C# like this

- lalityad2012 October 30, 2018 in India

a1 = [1, 2, 3, 4];

a2 = ["a", "b", "c"];

result a3 = [a1, b2, c3, d4];| Report Duplicate | Flag | PURGE

Jr. Software Engineer .Net/C# - 0of 0 votes

AnswersYou have two files in hdfs one having date range with two columns start date and end date and another having two column with date and visitors field. You have to write a spark code which gives date range having maximum no. of visitors using that two files.

- tokritijain October 30, 2018 in India| Report Duplicate | Flag | PURGE

Amazon Data Engineer - 0of 0 votes

AnswersYou are given an array A of size N and Q queries. For each query, you are given two indices of the array L and R. The subarray generated from L to R is reversed. Your task is to determine the maximum sum of the subarrays.

- Sameer October 29, 2018 in United States

Note: After each query is solved, the array comes to its initial states.

Input format

First line: Two space-separated integers N and Q

Next line: N space-separated integers denoting the array elements.

Next

Q lines: Two space-separated integers in every line denoting the values of Li and Ri

Output format

For each query, print the required answer in a new line.

5 2

3 -1 4 2 -1

3 4

1 2

//output

8

9| Report Duplicate | Flag | PURGE

Facebook Software Developer - 0of 0 votes

AnswersConvert infix to postfix and evaluate postfix expression.

- user October 28, 2018 in United States

For example: 4 // number of variables

g = 2

p = 3

t = 1

w = 2

3 // number of equations

g + p x t - w x p

t - g + t - w

e + t x t - m

Output: -1 //for first equation

-2 //for second equation

Compilation Error // for third equation| Report Duplicate | Flag | PURGE

Facebook Testing / Quality Assurance - 0of 0 votes

AnswersConvert infix to postfix and evaluate postfix expression.

- user October 28, 2018 in United States

For example: Input:

3 // number of variables

a = 1

b = 2

c = 2

2 // number of equations

a x b + a x c + b x c

a x c - b / c + c x c

Output: 8 //for first equation

5 // for second equation| Report Duplicate | Flag | PURGE

Facebook Testing / Quality Assurance - 0of 0 votes

AnswersGiven n boxes of different weights and m machines of different weight carrying capacity. Find the minimum time required to move all boxes.

- vivekagal1998 October 28, 2018 in India

Machines Capacities : C[0] , C[1] , C[2],........C[m-1].

Box Weights : W[0] , W[1] , W[2] .... W[n].

Each machine takes 1 minute to carry one time. What can be the optimal approach recursive approach will be to try assigning current box to given machine and not assign and recur for rest of thee boxes.

Note: A single machine can carry boxes multiple times , Each round trip takes exactly 1 unit time.| Report Duplicate | Flag | PURGE

Directi Software Engineer - 1of 1 vote

AnswersHow to evaluate a mathematical expression by compiler design. The program will ask the user to input a value (say n). Then user will input n lines of input each of which contains an identifier and its corresponding value. Then program will ask the user again to input a value (say m). Then user will input m lines of expressions. Calculate the final value for each of the given expression using first n lines of input. If you can't evaluate any expression from given numbers of identifiers then output 'Compilation Error'. Allowed mathematical operators are +(add), -(subtract), x(multiply), /(divide).

- user October 27, 2018 in United States

Example: a = 1

b = 2

c = 2

a x b + a x c + b x c output 8

a x c - b / c + c x c out put 5

g = 2

p = 3

t = 1

w = 2

g + p x t - w x p output -1

t - g + t - w output -2

e + t x t - m output compilation error| Report Duplicate | Flag | PURGE

Facebook Software Engineer - 0of 0 votes

AnswersConsultant

- quickbooktech321 October 27, 2018 in United States for 5000 Employees

QuickBooks specialists are available at QuickBooks Technical Support to determine your issues. QuickBooks client benefit number has expectation is to settle your issues instantly. You can connect with us our QuickBooks Support Number 1-844-444-4174 which is accessible at your administration constantly. For any questions please associating on our QuickBooks Help Number will enable you to investigate and settle the issue instantly.| Report Duplicate | Flag | PURGE

techsupport Financial Application Engineer - 2of 2 votes

AnswersGiven the root of a binary tree, print the nodes column wise and row wise.

`..............6 ............/....\ ...........9......4 ........../..\......\ .........5....1.....3 ..........\........./ ...........0.......7`

The answer would be 5 9 0 6 1 4 7 3.

- Champaklal October 26, 2018 in United States| Report Duplicate | Flag | PURGE

Facebook Software Developer Algorithm - -3of 3 votes

Answerbinary search

- James666 October 22, 2018 in United States| Report Duplicate | Flag | PURGE

Google Software Engineer

**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.

Open Chat in New Window