## Forum Posts

- 0 Answers
**How to get the combination in matrix**How to get the combination in matrix. For ex: we have martrix as shown below.

- hebbaruday April 10, 2014

A D E

B null F

C null null

Consider A B C are root nodes i.e first columns and each column we have to pick the one element and generating the combination.

ADE

ADF

BDE

BDF

CDE

CDF

A D E

B Z F

C null null

ADE

ADF

AZE

AZF

BDE

BDF

BZE

BZF

CDE

CDF

CZE

CZF| Flag | PURGE - 4 Answers
**Square Board : Grasshoper on ChessBroad**0

- jsd.learner April 03, 2014

of 0 votes

1

Answer

Unable to get what exactly the Question Is?

so What is the whole logic behind this question .It seems to be complete Math problem to me.

There is a Grasshopper in a tropical forest. The grasshopper can jump only vertically and horizontally, and the length of jump is always equal to x centimeter. A GRasshopper has found herself at the center of some cell of the chess board of the size pxq centimeters(each cell is 1x1 centimeters). She can jump as she wishes for an arbitrary number of times, she can even visit a cell more than once. the only restriction is that she cannot jump out of the board.

The grasshopper can count the number of cells that she can reach from the starting position(x,y). Let's denote this amount by dx,y. your task is to find the number of such starting position(x,y), which have the maximum possible value of dx,y

Input

The integer array contains three integers p,q,x

p= length of the board

q= width of the board

x=length of the grasshoppers jump.

Output

Output the only integer - the number of the required starting position of the Grasshopper

Example

input 2 3 1000000

output 6

input 3 3 2

output 4

Regards,

JSD| Flag | PURGE - 0 Answers
**Alternative solution for problem 5.3 from 'Cracking Coding Interview" book**Just something I cannot not share :) I think we can avoid loops in this problem:

- bufistov April 03, 2014

uint64_t GetNext_NP(uint64_t n)

{

if (n == 0 || n == -1ull)

{

return 0;

}

uint64_t first_one_mask = ((n ^ (n - 1) ) + 1) >> 1;

uint64_t first_zero_mask = ((n ^ (n + first_one_mask)) & (n + first_one_mask));

n |= first_zero_mask;

first_zero_mask >>= 1;

n &= ~first_zero_mask;

n &= ~(first_zero_mask - 1);

n |= (first_zero_mask / first_one_mask) - 1;

return n;

}| Flag | PURGE - 0 Answers
**Amazon Interview question**Suppose your team needs to launch a new recommendation feature called “Stuff Your Friends are Buying”. The recommendation logic is based on the following rules:

- nikitaamalhotra1991 March 28, 2014

• A customer should only be recommended product that their friends bought but they haven’t bought.

• The recommendations priority is driven by how many friends have purchased the same item – if multiple friends purchased the same item, it should be higher in the recommendations than a product that only one friend owns.

You are provided two library functions to help you

• getFriendsListForUser – returns a list of customer IDs (strings that uniquely identify an Amazon user) representing the friends of an Amazon user

• getPurchasesForUser – returns a list of product IDs (strings that uniquely identify an item in the Amazon catalog) for an Amazon user ordered by purchase time with newest purchase first in list and oldest purchase last in list

For this evaluation, please:

1) Write a function that provides a ranked (high to low) list of recommendations (product IDs) for a provided user.

2) Write code for a few key unit tests for your code.

3) Enumerate other unit test scenarios (code not required).

4) Provide the space and time complexity of your solution.| Flag | PURGE - 0 Answers
**morgan stanley interview**i want to know about morgan stanley interview question.it is hard like amazon, facebook and google or too much simple like infosys and tcs.

- anonymous March 27, 2014

i want to prepare for morgan stanley so can any one tell me difficulty level of interview ?

any tips or experiences would be greatly appreciated!| Flag | PURGE - 1 Answer
**Salesforce Interview(Software/QA Engineer)**Could anyone share their experience with the salesforce interview? Specifically the remote coding test and also the onsite interview?

- Liondancer March 24, 2014

I want to prepare as much as I can for the coding test so knowing previous questions asked is a big plus!

Thank you! Much Appreciated!| Flag | PURGE - 2 Answers
**Salesforce Interview(Software/QA Engineer)**Could anyone share their experience with the salesforce interview? Specifically the remote coding test and also the onsite interview?

- Liondancer March 24, 2014

I want to prepare as much as I can for the coding test so knowing previous questions asked is a big plus!

Thank you! Much Appreciated!| Flag | PURGE - 1 Answer
**Books for System Design and ML Interviews**I interviewed with Google last week after preparing with Gayle's CTCI book. The recruiter got back to me and said they'd like to have a couple of follow-up interviews focusing on System design and my domain expertise (Machine learning). Any suggestions on books to prepare for these interviews?

- qwanta2 March 23, 2014| Flag | PURGE - 0 Answers
**Books for System Design and ML Interviews**I interviewed with Google last week after preparing with Gayle's CTCI book. The recruiter got back to me and said they'd like to have a couple of follow-up interviews focusing on System design and my domain expertise (Machine learning). Any suggestions on books to prepare for these interviews?

- qwanta2 March 23, 2014| Flag | PURGE - 1 Answer
**I want to know algo for below problem**you are given 3 values say a, b and x.

- amlogin026 March 19, 2014

you can perform 3 ops:

X-> a=a+b

Y-> a=a-b

Z-> b = a-b

now performing these ops on a and b you have to get value x in var a.

ex: a = 19, b = 7, x = 27

if you perform YZXXX on a and b you will get a = 27.| Flag | PURGE

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

Open Chat in New Window