Google Interview Question for SDE1s


Country: United States




Comment hidden because of low score. Click to expand.
0
of 0 vote

Let F(N,L,K) = N*(N-1)...(N-K) * [(N-K)*(N-K)*....(N-L)].(length is L)
The answer should be :
F(N,L,K) - C(N,1)F(N-1,L,K) + C(N,2)F(N-2,L,K)F(N,3)F(N-3,L,K) .....where C(n,i) means combination number of selecting i items from n items.

- lxfuhuo January 08, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

Number of Songs: N
Number of Songs to be played: L
Interval between the same song: K

Initially all songs has to be played, After playing N songs, Remaining number of songs to be played L-N.
Initial N songs can be selected in N! ways.

The Interval between the same song should be K, The remaining songs for selection are 'N-K'.

The Answer: N! * (N-K) power of (L-N)

Ex: N: 1,2,3 L-5 and K-2

The possible options:
1 2 3 1 2
1 3 2 1 3
2 1 3 2 1
2 3 1 2 3
3 1 2 3 1
3 2 1 3 2


Please correct the Answer/Approach if its incorrect.

- Vijaya Bhaskar Golla December 16, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

N! * (N-K) power of (L-N)

- Anonymous December 16, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

N! * (N-K) power of (L-N)

- NoName December 16, 2017 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More