## Twitter Interview Questions

- 0of 0 votes
1) You have a folder full of .bin files that are proprietary.

2) You have a class called converter with a "binToTSV" method which you can pass the name of a .bin file and will generate a .tsv file.

3) The TSV file is a tab separated value file with a key on each line, and a value next to it spaced with a tab as such.

-------

num_connections 65

latency_ms 70

bandwidth 20

.... //etc.

-------

Q: Write a method to calculate the average latency and total bandwidth.

- 1of 1 vote
Objective: Write a function to find all the combinations of three numbers that sum to zero

Sample input:

[2, 3, 1, -2, -1, 0, 2, -3, 0]

Sample output:

2, -2, 0

1, -1, 0

3, -2, -1

3, 0, -3

3, 0, -3

- 1of 1 vote
write a function that has an int as input and return the equivalent String as an output

12 -> 'twelve'

4345 -> 'four thousand three hundred and forty-five'

7654567643 -> 'seven billion six hundred and fifty-four million five hundred and sixty-seven thousand six hundred and forty-three'

- 0of 2 votes
You have n - 1 numbers from 1 to n. Your task is to find the missing number.

I.e.

n = 5

v = [4, 2, 5, 1]

The result is 3.

- -2of 2 votes
Given an array with numbers, your task is to find 4 numbers that will satisfy this equation:

A + B + C = D

- 1of 1 vote
given two nodes of a binary tree, find number of nodes on the path between the two nodes.

`1 2 3 4 5 4, 3 -> (4-2-1-3): 4`

- -2of 2 votes
Two sorted 2D arrrays, get the third one sorted

A = [["a", 1], ["b", 2]] sorted all elements have different names

B = [["a", 2], ["c", 3]] sorted

C = [["a", 3], ["b", 2], ["c", 3]] sorted

- 0of 2 votes
Implement LRU cache.

- 0of 0 votes
Given a list of names. Find whether a particular name occurs inside a given tweet or not. If found return true otherwise false Time complexity should be less than O(n).

Ex: "Katy Perry","Ronan Keating" given as a list of string.

List<String> names;

bool findName(String tweet)

{

}

- 0of 0 votes
Given a preorder sequence from a Binary Tree, how many unique trees can be created from this? (They want a recurrence relation and start with the easy cases):

T(0) = 1

T(1) = 1

T(2) = 2

What is T(N) ?

- -2of 4 votes
For a technical phone screen:

Given a string "aaabbcccc", write a program to find the character with the second highest frequency.

- 0of 0 votes
given 4 points, whose x and y coordinates are both integers. they are all different. write a function to check if they form a square.

i forgot to point out that the points can be given in any order

- 0of 0 votes
Write a method to validate that given Binary tree is a BST.

- 0of 0 votes
Given a Tuple for eg. (a, b, c)..

Output : (*, *, *), (*, *, c), (*, b, *), (*, b, c), (a, *, *), (a, *, c), (a, b, *), (a, b, c)

- 1of 1 vote
String getSentence(String text, Set<String> dictionary);

// text is a string without spaces, you need to insert spaces into text, so each word seperated by the space in the resulting string exists in the dictionary, return the resulting string

// running time has to be at least as good as O(n)

// getSentence("iamastudentfromwaterloo", {"from, "waterloo", "hi", "am", "yes", "i", "a", "student"}) -> "i am a student from waterloo"

- 0of 0 votes
Build an HTTP Library that is common and can be used by various clients like Twitter, Gmail, facebook etc. What features would you add into this library

- 0of 0 votes
Write a class hashmap and implement: insert, get and delete (Open addressing/chaining). What points to be considered before going to production (focus on concurrency)

- 0of 0 votes
Design a modified stack that in addition to Push and Pop can also provide minimum element present in the stack via Min function.

- 0of 0 votes
Design a hash table that is thread safe. That is it can support concurrent reads but protects on write.

- 1of 1 vote
Design a collaborative text editor where each participant has infinite undo/redo. Consider the scenario where a user goes offline and then comes online and tries to undo/redo.

- 0of 0 votes
Given a sorted array that is sorted by rotated, find a given number. For example take an array: 1 3 8 10 12 56 and rotate it so you have 10 12 56 1 3 8 and then find a candidate e.g. 3 in it.

- 0of 0 votes
Given a string representing sorted numbers with spaces print the count of each number. For example if the input string is: "1 1 2 3 4 4" then you should print 1:2, 2:1, 3:1, 4:2

Then the question was modified so there could be invalid number in the string which must be skipped.

Then an added requirement to handle hex numbers in the string.

- 0of 0 votes
Given a string representing roman numeral, find and return its numeric value. e.g. XXIV = 24 and so on.

- 0of 0 votes
Leader election algorithm in a distributed system.

- 0of 0 votes
Describe how to get the top k queries from a search log of terabytes of data. Memory/Disk per machine is limited but you can use multiple machines.