Oracle Interview Question for Applications Developers


Country: India




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

Formula is:
((N-i)! Up to i=K)*((N-k)^(N-i)) where i Is iterating from 0 to N

- Amauris February 07, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Could you please confirm me whether this formula is the correct solution for this problem

- James September 27, 2016 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

8.void main()
9.{
10. int i, n, sum = 0;
11. int *a;
12.
13. printf("Enter the size of array A \n");
14. scanf("%d", &n);
15. a = (int *) malloc(n * sizeof(int));
16. printf("Enter Elements of First List \n");
17. for (i = 0; i < n; i++)
18. {
19. scanf("%d", a + i);
20. }
21. </* Compute the sum of all elements in the given array */
22. for (i = 0; i < n; i++)
23. {
24. sum = sum + *(a + i);
25. }
26. printf("Sum of all elements in array = %d\n", sum);
27.}

- Anonymous February 25, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

8.void main()
9.{
10. int i, n, sum = 0;
11. int *a;
12.
13. printf("Enter the size of array A \n");
14. scanf("%d", &n);
15. a = (int *) malloc(n * sizeof(int));
16. printf("Enter Elements of First List \n");
17. for (i = 0; i < n; i++)
18. {
19. scanf("%d", a + i);
20. }
21. </* Compute the sum of all elements in the given array */
22. for (i = 0; i < n; i++)
23. {
24. sum = sum + *(a + i);
25. }
26. printf("Sum of all elements in array = %d\n", sum);
27.}

- Anonymous February 25, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 2 vote

Answer: Nx(N-1)x...x(N-K+1)x(N-K)^(L-K) - (the number of posibilities where at least one song is not played).

- s100banerjee May 20, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Answer: Nx(N-1)x...x(N-K+1)x(N-K)^(L-K) - (the number of posibilities where at least one song is not played).

- s100banerjee May 20, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The following cases must be eliminated.
Case 1) Only K songs are present => (NcK)xKx(K-1)...x2
Case 2) Only K+1 sings are present =>(Nc(K+1)) x(K+1)xK...x2
......
.....
Case N-K) Only N-1 songs are present => N x (N-1)x(N-2)x(N-K)x(N-1-K)^(L-K)

Let the sum be S
The answer is Nx(N-1)x...x(N-K+1)x(N-K)^(L-K) - S

- s100banerjee May 20, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Assuming order of play doesn't result in different playlists the number of playlists will be (nCk)*n^(l-k). If order matters this will be (n!/k!)*n^(l-k).

- Anonymous August 20, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

NCK * K! * (L-K)C(N-K) * (N-K)! * (N-K)^(L-N)

- Anonymous November 24, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

(N!/(N-K)!) * (N-K)^(L-K+1) assuming L > K and N >= K

For the first K songs, we have a decreasing list of possibilities
1st song - N
2nd song - (N-1)
3rd song - (N-2)
...
ith song (i < K) - (N-i)
Kth song - (N-K)

After this, for each song, one of the songs from the earlier choice is also valid thus always ensuring that the available songs is (N-K) for the remaining (L-K) songs

- Anonymous May 07, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

In the original task there are constrains:
N lies between 1 and 100, inclusive.
L lies between 0 and N, inclusive.
K lies between N and 100, inclusive.

So K≥N. The Nx(N-1)x...x(N-K+1)x(N-K)^(L-K) formula is incorrect.
I thin the formula is incorrect even without these constraints.

- Eugene January 28, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The original task has constraints
- N lies between 1 and 100, inclusive.
- L lies between 0 and N, inclusive.
- K lies between N and 100, inclusive.

So K≥N, the formula Nx(N-1)x...x(N-K+1)x(N-K)^(L-K). I think it is incorrect even without these constrains.

- eugenegrednov January 28, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I think it will be N * (N-1)CK * (N-K)^(L-K+1)

- Jagan January 31, 2018 | 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