## StartUp Interview Questions

- 0of 0 votes
It was asked in Chargebee off campus interview. Needed solution for this problem in java

Given a string say s and k denotes the number of commas and the output should be like when you insert the comma in the string at different places and find the maximum number.

Test case 1

say s = 999 and k = 1 so the choice would be 9,99 or 99,9 in either case the maximum number is 99

Test case 2

say s=999 and k =2 so the choice will be like 9,9,9 so output will be 9

Test case 3

say s = 857 and k = 1 the choice would be 85,7 or 8,57 so the output will be like 85

- -1of 1 vote
Email customer Service Technical Solution for Every Client 1800-342-543

- 0of 0 votes
The following is the design question I was asked.

Design a dash board.

Should be very realistic.

Should be scalabe .

Should have very less latency .

Can expect millions of updates per second.

Dash board should show :

for each day :

1. city name ,

2.total trips in that city for that day ,

3.total fare it could collect in that city on that day,

4. fare collected from old clients

5. fare collected from new clients (new client is the client who is having his first ride in Uber after registration)

Input : we get two strings s1 , s2.

the format of s1 : trip_id , client_id , city , datetime

the format of s2 : trip_id , fare.

Could you please suggest how to proceed for this kind of question?

- 0of 0 votes
Given is an algebraic expression involving only positive integers and the operators +

and - . Design a greedy O(n) and dyamnic O(n3) solution.

For example, 5 + 3 − 6 − 7, the maximum possible value of the

expression is 7. One way of achieving this value is by parenthesizing as follows: (5 +

(3 − (6 − 7)))

- 0of 0 votes
I was asked this question in an algorithm interview. Since my coding language was javascript I was asked to implement a hashmap n white board with collision detection.

I guess they were looking for a hashing algorithm that will create a linked list in case of a collision and also an equals method

- 0of 0 votes
Javascript check if string can be chained:

Given an array of strings, find if the strings can be chained to form a circle.

Eg:

arr = ["aab", "bac", "aaa", "cda"]

can be chained as "aaa"-> "aab"-> "bbb" -> "baa"

(Each string differs by one letter)

- 0of 0 votes
Create a function Demo that takes input a function f and a parameter k, and returns a function that behaves the same as f except it caches the last k distinct accessed results of f.

Demo_f = Demo(f,2)

demo_f(arg1) - computed and cached

demo_f(arg1)- returned from cache

demo_f(arg2) - computed and cached

demo_f(arg3) - computed and cached, f(agr1) is evicted

I think its related to python decorators. Some one can give a hint how can I get started with this

- 0of 0 votes
You have an app that uses a 3rd party video player. The VP has the functionalities - play, pause, seek and close. On close, the VP makes a callback to your app. To the callback it sends the below parameters

* videoLengthInSecs

* VideoPart[]. VideoPart {startTime, endTime}. Denotes a continuous part of the video that was watched without any disturbance caused by pause, seek.

Your app should be able to determine whether the user has watched the entire video or not.

60, [{0, 30}, {30, 60}]

return boolean

- 0of 0 votes
/* do not use any JAVA APIs(Ex:Calenders)

Write a method that takes an instance of our new class SimpleDate and returns the first day of the next calendar quarter (i.e. Jan 1, 2000; April 1, 2000, etc.) as a SimpleDate.

/**

Simple data structure representing a Date

*/

public class SimpleDate {

protected int year = 0;

protected int month = 0;

protected int day = 0;

public SimpleDate (int year, int month, int day) {...}

public void setDate (int year, int month, int day) {...}

public void setYear (int year) {...}

public int getYear () {...}

public void setMonth (int month) {...}

public int getMonth () {...}

public void setDay (int day) {...}

public int getDay () {...}

}

// 3/17/2009 -> 4/1/2009

- 0of 0 votes
From a web page, each logged in user can click on a plus icon and enter key-value pairs. There is restriction on the entered key and values. Design a schema to store the enter the key-value pairs entered by each user, such that given a key we should be able to retrieve all the username who entered that particular key.

- 2of 2 votes
Constructing Bridges:

A River that cuts through a set of cities above and below it. Each city above the river is matched with a city below the river.

Construct as many Non-Crossing Bridges as possible.

Input:

Above Bank >> 7 4 3 6 2 1 5

Below Bank >> 5 3 2 4 6 1 7

are given in pairs: (7,5) (4,3) (3,2) (6,4) (2,6) (1,1) (5,7)

Output:

(1,1) (3,2) (4,3) (6,4) (7,5)

- 0of 0 votes
you have 2 lists of points

- for one point in the first list, you have to find all the points in the second list that are in a certain radius with a fast algorithm

- 0of 0 votes
- there is a large filed (dimensions are specified)

- Given a list of rice varieties that can be grown on a square plots (of 2X2) in the large field.

- Given the dimensions of the large field we can find out the number of individual plots that can be cut out (rows and columns)

- Each variety has its own pollination period specified by start and end date.

- We have to assign plot to each variety such that there is no intersection in pollination period of neighbouring varieties.

- Neighbouring variety is the variety grown in the adjacent plot. Any plot can have a max of 8 neighbours

- The output is a 2D matrix representation, where each cell is a plot. Each plot is assigned at most one variety of rice.

- Each variety of rice can be assigned to at most one plot

- Maximise the number of varieties used. (minimise the number of vacant plots)

eg:

name,start_date,end_date

V1,11Sep,15Sep

V2,13Sep,20Sep

V3,1Oct,4Oct

V4,25Sep,30Sep

- it is ok if some plots are left empty

- no_of_rice_varieties <=1000

- 0of 0 votes
explain with example when to use mutex and when to use semaphore

- 0of 0 votes
Design LRU in C++

- 0of 0 votes
Design Garbage Collector in C++.

- 0of 0 votes
Design a Tic Tac Toe Game. Classes Segregation and Code Flow.