iamthe0ne
BAN USER- 2of 4 votes
AnswersImplement LRU cache.
- iamthe0ne 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 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
If additional memory is allowed we can use 2 arrays one for rows and one for columns and two variables for keeping track of diagonals......
Increase the count at row index by one and the same for columns...and increase the diagonal count if i == j
also to keep track of repeated random nos we can always find the index of the no which is generated and check at that index if it is present already or not....to find the index of the no divide the no by n the row will the quotient and the column will be the remainder..if the remainder is 0 then place it in the last column with the row being the quotient....
Repjoyceeallard, Associate at Adap.tv
Hi, i am working as a training manager as a business professional who assesses the growth and development needs of ...
Reprchierusel, Applications Developer at Allegient
I am a Real-time captioner in the USA . Real-time captioning can be used for programs that do not have written ...
Repmelissamewingm, abc at ABC TECH SUPPORT
I am Melissa from Springdale. I function as an Auditing assistant in Bountiful Harvest Health Food Store. My solid interest ...
This problem has many solutions if the two arrays are of equal size, if not then there is a really complex solution which is iterative which considers three cases where one array lies completely inside another array and similar two other cases. There is a solution given by an MIT Prof for unequal arrays which is recursive and very elegant.
- iamthe0ne September 19, 2014The OP has not mentioned what is the constraint on array sizes.