Twitter Interview Questions
- 1of 1 vote
AnswerGiven an undirected graph represented as a list of edges, find out the number of connected component.
- aonecoding June 25, 2018 in United States| Report Duplicate | Flag | PURGE
Twitter Software Engineer - 2of 2 votes
AnswerTwitter
- aonecoding January 04, 2018 in United States
Create a simple stack which takes a list of elements.
Each element contains a stack operator (push, pop, inc) and a value to either push/pop or two values, n and m,
which increment the bottom n values by m.
Then print the topmost value of the stack after every operation. If the stack is empty, print "empty"| Report Duplicate | Flag | PURGE
Twitter Software Engineer Algorithm - -1of 1 vote
AnswersEmployees Per Department
- aonecoding September 05, 2017 in United States
Twitter Interview Online Test SQL
A company uses 2 data tables, Employee and Department, to store data about its employees and departments.
Table Name: Employee
Attributes:
ID Integer,
NAME String,
SALARY Integer,
DEPT_ID Integer
Table Name: Department
Attributes:
DEPT_ID Integer,
Name String,
LOCATION String
View sample tables:
https://s3-us-west-2.amazonaws.com/aonecode/techblog/50cfcdd1d61f1bd6002cf4d3b4a61deb-min.jpeg
Write a query to print the respective Department Name and number of employees for all departments in the Department table (even unstaffed ones).
Sort your result in descending order of employees per department; if two or more departments have the same number of employees, then sort those departments alphabetically by Department Name.| Report Duplicate | Flag | PURGE
Twitter Software Engineer SQL - 0of 0 votes
AnswersDesign a system to find top 10 twitter hashtags in the most recent 1 min, 10 min, 1 hr
- AlgoBaba August 28, 2017 in United States| Report Duplicate | Flag | PURGE
Twitter Data Engineer Software Design - 0of 0 votes
AnswersInput: expression_tree | sequence_of_operations
- ajay.raj August 20, 2017 in United States
The input is a single line of text with a expression tree and a sequence of operations separated by | character and ended by a \n newline character. Spaces are allowed in the input but should be ignored.
The expression tree is a sequence of 1-character variables A-Z and with sub expression trees formed by parenthesis (expression_tree). Examples: AB, A(B C D), (AB)C((DE)F)
The sequence of operations is a string of with characters R (reverse) or S (simplify)
Reverse means reverse the order of everything in expression tree. Applying reverse twice in a row cancels out. Example: (AB)C((DE)F) | R should print (F(ED))C(BA)
Simplify means remove the parentheses around the very first element in the expression tree and each of its subexpression trees. Applying S multiple times should have same result as applying S once. Example: (AB)C((DE)F) | S should print ABC(DEF)
String process(String input){
}| Report Duplicate | Flag | PURGE
Twitter SDE1 - 0of 0 votes
AnswerSolve the 24 Game
- aonecoding August 14, 2017 in United States| Report Duplicate | Flag | PURGE
Twitter Software Engineer Algorithm - 0of 0 votes
AnswersThere is a DNA Strand having values as A , T , C , G.
- saurabh.desi.bhatt October 11, 2016 in United States
All combinations are present in the the file.
Write a method which takes starting mutation string , ending mutation string and string bank and calculates the minimum mutation distance required. But the condition is that either of the start or end must be present in the bank.
Input:
AATTGGCC is starting and TTTTGGCA is ending then mutation distance will be 3.
AATTGGCC - TATTGGCC - TTTTGGCC - TTTTGGCA as it takes three mustaion for start to reach the end string and for this , all intermediate string and final string must be present in the bank.
static int findMutationDistance(String start, String end, String[] bank) {
}| Report Duplicate | Flag | PURGE
Twitter Intern Java - 0of 0 votes
AnswersYou have a string of phrases present. For your simplicity consider them to be integer length.
- saurabh.desi.bhatt October 11, 2016 in United States
String s= " I am Tom"
will be stored in an interger array as [1,2,3] where each represents length of each word in the string.
Write a method to compute the longest subsequence such that it is less than given k value.
Input:
3 //length of array
1 //a[0]
2 //a[1]
3 //a[2]
4 // value of k
Output:
2
Input:
4 //length of array
3
1
2
1
4 //value of k
Output:
3
static int maximumLength(int[] a, int k) {
}| Report Duplicate | Flag | PURGE
Twitter Intern Java - 1of 1 vote
AnswersFind the anagrams from a list of strings
- coder145 April 19, 2016 in United States
Input : {"tea", "ate", "eat", "apple", "java", "vaja", "cut", "utc"}
Output : {"tea", "ate", "eat","java", "vaja", "cut", "utc"}| Report Duplicate | Flag | PURGE
Twitter Senior Software Development Engineer Algorithm - 0of 0 votes
AnswersDesign a unique hash function for every tweet in Twitter which will be used as part of a service.
- Ray October 04, 2015 in United States| Report Duplicate | Flag | PURGE
Twitter SDE1 Hash Table - 2of 2 votes
AnswersGiven an array of task and k wait time for which a repeated task needs to wait k time to execute again. return overall unit time it will take to complete all the task.
- hm September 14, 2015 in United States
Example:
1. A B C D and k = 3
ans: 4 (execute order A B C D)
2. A B A D and k = 3
ans: 6 (execute order A B . . A D)
3. A A A A and k =3
ans: 13 (A . . . A . . . A . . . A)
4. A B C A C B D A and k = 4
ans: 11 (A B C . . A .C B D A )| Report Duplicate | Flag | PURGE
Twitter Software Engineer Algorithm - 0of 0 votes
AnswersDesign Twitter.
- AlgoBaba August 13, 2015 in United States| Report Duplicate | Flag | PURGE
Twitter Software Engineer design - 1of 1 vote
Answers1) You have a folder full of .bin files that are proprietary.
- haroldtreen January 03, 2015 in United States
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.| Report Duplicate | Flag | PURGE
Twitter Software Engineer / Developer Coding - 0of 2 votes
AnswersObjective: Write a function to find all the combinations of three numbers that sum to zero
- intervyou April 19, 2014 in United States
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| Report Duplicate | Flag | PURGE
Twitter Software Engineer / Developer Algorithm - 1of 1 vote
Answerswrite a function that has an int as input and return the equivalent String as an output
- intervyou April 19, 2014 in United States
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'| Report Duplicate | Flag | PURGE
Twitter Software Engineer / Developer Algorithm - 0of 2 votes
AnswersYou have n - 1 numbers from 1 to n. Your task is to find the missing number.
- Alexandru Mihai December 11, 2013 in United States
I.e.
n = 5
v = [4, 2, 5, 1]
The result is 3.| Report Duplicate | Flag | PURGE
Twitter Software Engineer Intern - -2of 2 votes
AnswersGiven an array with numbers, your task is to find 4 numbers that will satisfy this equation:
- Alexandru Mihai December 11, 2013 in United States
A + B + C = D| Report Duplicate | Flag | PURGE
Twitter Software Engineer Intern Arrays - 1of 1 vote
Answersgiven two nodes of a binary tree, find number of nodes on the path between the two nodes.
- codemonkey September 11, 2013 in United States1 2 3 4 5 4, 3 -> (4-2-1-3): 4
| Report Duplicate | Flag | PURGE
Twitter Software Engineer / Developer - -4of 4 votes
AnswersTwo sorted 2D arrrays, get the third one sorted
- codemonkey September 11, 2013 in United States
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| Report Duplicate | Flag | PURGE
Twitter Software Engineer / Developer - 2of 4 votes
AnswersImplement LRU cache.
- iamthe0ne August 16, 2013 in United States| Report Duplicate | Flag | PURGE
Twitter Software Engineer / Developer Algorithm - 0of 0 votes
AnswersGiven 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).
- iamthe0ne August 16, 2013 in United States
Ex: "Katy Perry","Ronan Keating" given as a list of string.
List<String> names;
bool findName(String tweet)
{
}| Report Duplicate | Flag | PURGE
Twitter Software Engineer / Developer Algorithm - 0of 0 votes
AnswersGiven 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):
- nimbus August 06, 2013 in United States
T(0) = 1
T(1) = 1
T(2) = 2
What is T(N) ?| Report Duplicate | Flag | PURGE
Twitter Software Engineer / Developer Brain Teasers - -2of 4 votes
AnswersFor a technical phone screen:
- mgm.globalization July 14, 2013 in United States for International
Given a string "aaabbcccc", write a program to find the character with the second highest frequency.| Report Duplicate | Flag | PURGE
Twitter Software Development Manager Coding - 0of 0 votes
Answersgiven 4 points, whose x and y coordinates are both integers. they are all different. write a function to check if they form a square.
- jcyeak March 24, 2013 in United States
i forgot to point out that the points can be given in any order| Report Duplicate | Flag | PURGE
Twitter Algorithm - 0of 0 votes
AnswersWrite a method to validate that given Binary tree is a BST.
- inheritance January 23, 2013 in United States| Report Duplicate | Flag | PURGE
Twitter Software Engineer / Developer Algorithm - 0of 0 votes
AnswersGiven a Tuple for eg. (a, b, c)..
- xyz.buffer January 10, 2013 in United States
Output : (*, *, *), (*, *, c), (*, b, *), (*, b, c), (a, *, *), (a, *, c), (a, b, *), (a, b, c)| Report Duplicate | Flag | PURGE
Twitter Software Engineer / Developer Algorithm - 1of 1 vote
AnswersString getSentence(String text, Set<String> dictionary);
- Vincent October 29, 2012 in United States
// 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"| Report Duplicate | Flag | PURGE
Twitter Google Software Engineer / Developer Software Engineer in Test Algorithm - 0of 0 votes
AnswersBuild 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
- PAPA October 13, 2012 in United States| Report Duplicate | Flag | PURGE
Twitter System Design - 0of 0 votes
AnswersDesign a modified stack that in addition to Push and Pop can also provide minimum element present in the stack via Min function.
- ashish.kaila March 05, 2012 in United States| Report Duplicate | Flag | PURGE
Twitter Software Engineer / Developer Data Structures - 0of 0 votes
AnswersDesign a hash table that is thread safe. That is it can support concurrent reads but protects on write.
- ashish.kaila March 05, 2012 in United States| Report Duplicate | Flag | PURGE
Twitter Software Engineer / Developer Data Structures