## Recent Interview Questions

- 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>

- Anirudha 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

- Anirudha 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 - 2of 2 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

AnswerHow 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 - 0of 0 votes

AnswersExplain the difference between ORM and JDBC.

- mmoshikoo October 20, 2018 in United States

Provide some examples and when to use one over the other.| Report Duplicate | Flag | PURGE

Microsoft Software Developer General Questions and Comments - 0of 0 votes

Answersgiven two strings s1 and s2 we have to convert s1 into palindrome such that s1 contain s2 as a substring. in a minimum number of operation. wherein a single operation we can replace any word of s1 with any character.

- GB11 October 17, 2018 in India

constraint : |s1| <= 1000

|s2| <= |s1|

ex: s1 = "abaa" , s2 = "bb"

output : 1| Report Duplicate | Flag | PURGE

Walmart Labs Software Developer - 1of 1 vote

AnswersSuppose we want to build a scheduling app. We have the times people are currently busy, e.g.

- jasd October 17, 2018 in United States

{

Alice: [(13.5, 14), (15.75, 17)],

Bob: [(9, 12), (13, 14), (14, 16)],

Eve: [(9, 11), (12.5, 13.5), (14, 15), (16, 18)]

Mallory: [(0, 9), (12, 24)]

}

For simplicity, lets represent times as numbers between 0 and 24 and the times people are busy as (start_time, end_time) pairs. For example, (13.5, 14) means that Alice is busy from 1:30PM-2PM.

Given a list of people's schedules, write a function to return a list of the time intervals all the people in the list are free to meet.

For the example above, here's some sample output:

Alice, Bob => [(0, 9), (12, 13.5), (17, 24)]

Bob, Mallory => []

Alice, Bob, Eve => [(0, 9), (12, 12.5), (18, 24)]| Report Duplicate | Flag | PURGE

- 0of 0 votes

AnswersGiven an array which represents columns, find the position of two columns which when removed will trap the maximum amount of water. This is related to trapping raining water problem.

- Ashish October 17, 2018 in India| Report Duplicate | Flag | PURGE

Amazon Software Developer - 0of 0 votes

AnswersGiven an unsorted array find the maximum distance between two elements satisfying the condition A[i] < A[j] where i < j. There will always be a solution.

- Ashish October 17, 2018 in India

For eg. 6, 9, 3, 2, 10, 2, 3| Report Duplicate | Flag | PURGE

Amazon Software Developer - -2of 4 votes

AnswersHow should I prepare for the interview with Alexa team at Amazon?

- ihsihs005 October 17, 2018 in United States for Alexa| Report Duplicate | Flag | PURGE

Amazon SDE1 Data Structures

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

Open Chat in New Window