juny
BAN USER
- 2of 2 votes
Answers// cat, actor -> T // car, actor -> F bool anaStrStr (string needle, string haystack) { }
Write a function that takes 2 strings , search returns true if any anagram of string1(needle) is present in string2(haystack)
- juny in United States| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer Algorithm - 0of 0 votes
Answers
- juny in United Statespublic interface Intervals { /** * Adds an interval [from, to] into internal structure. */ void addInterval(int from, int to); /** * Returns a total length covered by intervals. * If several intervals intersect, intersection should be counted only once. * Example: * * addInterval(3, 6) * addInterval(8, 9) * addInterval(1, 5) * * getTotalCoveredLength() -> 6 * i.e. [1,5] and [3,6] intersect and give a total covered interval [1,6] * [1,6] and [8,9] don't intersect so total covered length is a sum for both intervals, that is 6. * * _________ * ___ * ____________ * * 0 1 2 3 4 5 6 7 8 9 10 * */ int getTotalCoveredLength(); }
| Report Duplicate | Flag | PURGE
Linkedin Software Engineer / Developer Algorithm - 0of 0 votes
Answers/**
- juny in United States
* Return the smallest character that is strictly larger than the search character,
* If no such character exists, return the smallest character in the array
* @param sortedStr : sorted list of letters, sorted in ascending order.
* @param c : character for which we are searching.
* Given the following inputs we expect the corresponding output:
* ['c', 'f', 'j', 'p', 'v'], 'a' => 'c'
* ['c', 'f', 'j', 'p', 'v'], 'c' => 'f'
* ['c', 'f', 'j', 'p', 'v'], 'k' => 'p'
* ['c', 'f', 'j', 'p', 'v'], 'z' => 'c' // The wrap around case
* ['c', 'f', 'k'], 'f' => 'k'
* ['c', 'f', 'k'], 'c' => 'f'
* ['c', 'f', 'k'], 'd' => 'f'
*/| Report Duplicate | Flag | PURGE
Linkedin Software Engineer / Developer Algorithm - 0of 2 votes
AnswersSearch in a rotated array for a given integer, it can be rotated clockwise or anticlockwise. Handle both
- juny in United States for AFT| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersDesign the system for Amazon website where if you purchase an item X , it shows "Customers who bought X also bought A,B,C items".
- juny in United States for AFT
Assume: if a customer buys A,B,C items in his history then they are all related and each one should appear in others| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Large Scale Computing - 0of 0 votes
AnswersDesign Coffee Shop? Follow up: Extend this to handle multiple coffee shops (Ex like starbucks and across countries)
- juny in United States for AFT| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Object Oriented Design - 2of 2 votes
AnswersYou are given numbers from 1 through 100 in an array, there is one number missing, find that one
- juny in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersYou are a cashier, and any item purchased in the store is in the range of 1c to 99c . Customer always pays 100 c i.e 1$. You need to deliver change with 25c, 10c,5c ,1c.
- juny in United States for Traffic
1. Code to get the most optimal solution with lease number of coins used
2. Some time in India 1 Rs = 150 ps and following coins were available {50,25,20,10,5,2,1}. Here if the change was 40, you should display 2 20ps and not 25ps,10ps,5ps. . What are the optimizations you will make| Report Duplicate | Flag | PURGE
Ebay SDE-2 - 1of 1 vote
AnswersGiven a 3-D array, if any m[r][c][d] is <=0 mark all the cells in the entire row,col and depth as zero and return the o/p array
- juny in United States for Traffic| Report Duplicate | Flag | PURGE
Ebay SDE-2 Arrays - 0of 0 votes
AnswersDesign event system, that is receiving events from various client (iPad,mobile,browser) across the world. It is getting approx 1 billion events /day. At any point of time the PM comes and says , retrieve how many events occurred in last 60s and we should be able to retrieve that
- juny in United States for Traffic| Report Duplicate | Flag | PURGE
Ebay SDE-2 System Design - 0of 0 votes
Answersyou are given a log file with userid, login time and logout time . The login/logout times are in terms of integers .
- juny in United States for Traffic
When given a time range with a difference of 1 i.e. (1-2) or (2-3) return how many users are online| Report Duplicate | Flag | PURGE
Ebay Software Engineer / Developer Algorithm - 0of 0 votes
AnswersGiven an array of integers, return the maximum subsequence subset and the sum formed by the subset
- juny in United States for Traffic| Report Duplicate | Flag | PURGE
Ebay Software Engineer / Developer - 0of 0 votes
AnswersUsing the symbols of Periodic table, return the longest word possible from the english dictionary
- juny in United States for Traffic| Report Duplicate | Flag | PURGE
Ebay Software Engineer / Developer Algorithm - 1of 1 vote
AnswersA Contracter is doing work for 7 days at your home, you need to pay him 7000$ in total. Every day you need to pay him 1000$ only .. To Pay him you have a gold plate wortjh 7000$ , but you can cut it only twice
- juny in United States for Traffic| Report Duplicate | Flag | PURGE
Ebay Software Engineer / Developer Brain Teasers - 0of 0 votes
AnswersDesign LRU Cache
- juny in United States for Traffic| Report Duplicate | Flag | PURGE
Ebay Software Engineer / Developer Object Oriented Design - 1of 1 vote
AnswersDesign Service like tinyurl
- juny in United States for Traffic| Report Duplicate | Flag | PURGE
Ebay Software Engineer / Developer Object Oriented Design - 0of 0 votes
AnswersStart with the sequence of non-zero digits 123456789. The problem is to place plus or minus signs between them so that the result of thus described arithmetic operation will be 100.
- juny in United States for Traffic| Report Duplicate | Flag | PURGE
Ebay Software Engineer / Developer Algorithm - 1of 1 vote
AnswersGiven 78 cents (target) you need to tell how many ways it is possible to make the change using 25 cents(quarter), 10 cents(nickel), 5cents(dime), 1cents(penny)
- juny in United States for Traffic| Report Duplicate | Flag | PURGE
Ebay SDE-2 Algorithm - 0of 0 votes
AnswersGiven following definition, implement hashmap
- juny in United States for TrafficPublic class HashMap { Public void put(object key, object value); Public void get(object value); }
| Report Duplicate | Flag | PURGE
Ebay SDE-2 Hash Table - 1of 1 vote
AnswersGiven a sorted array with duplicates, move the distinct elements to the top
- juny in United States for Traffic
Ex: 1,1,2,3,4,4,5 -> 1,2,3,4,5| Report Duplicate | Flag | PURGE
Ebay SDE-2 Arrays - 0of 0 votes
AnswersHow would you assign numbers if you were AT&T, describe a data structure
- juny in United States for Azure| Report Duplicate | Flag | PURGE
Microsoft SDE-2 Data Structures
You can use Priority Queue (represented by Doubly linked List), having pointers to both head and tail. Also maintain a hashtable which maps to nodes based on URL.
Foreach entry
{
if(URL is in hashtable)
{
Delete node from temp position, update count;
insert into head
}
else
{
Insert Node into head of DLL and set count to 1
}
}
GetTop3()
{
Retrieve first 3 nodes from the DLL, since they were accessed most recently.
}
geeksforgeeks.org/bipartite-graph/
- juny February 02, 2014