D.E.Shaw CodePair Round | off-campus
4666

D.E.Shaw Code Pair round interview experience. [Hackerrank]

Q). Coding [You need to run all test cases in Hackerrank]
Given an array, A. Let x be an element in the array. x has the maximum frequency in the array. Find the smallest subarray length of the array which also has x as the maximum frequency element.

e.g.
Input :  arr[] = {4, 1, 1, 2, 2, 1, 3, 3} 
Output :  5
The most frequent element is 1. The smallest
subarray that has all occurrences of it is
1 1 2 2 1

OTHER QUESTIONS :

Q1.
diference between #include<stdio.h> and #include "stdio.h"

Q2.
Diference between definition and declaration in any code written in any language.

Q3.
There is a infinit stream of bits (0/1) coming,
At each bit you need to check whether number formed from bits till given point is divisible by given N or not. How will you approach this problem.

we can't store stream anywhere as it is infinit.

e.g.
N = 14
stream = 10101100100010001010010.....

We need to answer at each bit comming from left to right.

Q4.
Puzzle :
A person has 3000 bananas and a camel. The person wants to transport the maximum number of bananas to a destination which is 1000 KMs away, using only the camel as a mode of transportation. The camel cannot carry more than 1000 bananas at a time and eats a banana every km it travels. What is the maximum number of bananas that can be transferred to the destination using only camel (no other mode of transportation is allowed).

Comments (7)