kamoliddin
BAN USER- 0of 0 votes
AnswersDesign packman game.
- kamoliddin in United States| Report Duplicate | Flag | PURGE
Amazon Application / UI Design - 0of 0 votes
AnswersDesign LRU cache data structure
- kamoliddin in United States| Report Duplicate | Flag | PURGE
Amazon Data Structures - 0of 0 votes
AnswersConvert relative path to absolute path.
for example:/windows/abs/../temp/new/.../
the output should be:
- kamoliddin in United States/windows/temp
| Report Duplicate | Flag | PURGE
Amazon Algorithm - 0of 0 votes
AnswersDesign saveEmail(), retrieveEMail() for our email system
- kamoliddin in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Application / UI Design - 0of 0 votes
AnswersDesign a file system for our operation system
- kamoliddin in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Application / UI Design - 0of 0 votes
AnswersSystem that can have 10K requests in a second. We need to save only the number of queries in a table. After 5 year user may want to see 5 years old history. user may want to see monthly history, history per yer, or per minute, per second(zoom in, zoom out). How would you design database.
- kamoliddin in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Database - 0of 0 votes
Answers10 000 integer numbers in an array, Each number is 10 bit. Sort the array
- kamoliddin in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm
We do not put in db or in no sql? There are millions of posts and trillions of likes, canyou imagine puytting them in ADT and holding in RAM?
- kamoliddin January 21, 2013BST
- kamoliddin September 28, 2012I forgot to check new word to check from dictionary:). Can give more detailed example. Sorry
- kamoliddin September 27, 2012findMissing(array a){
int tmp = a[0];
foreach(int i = 1 ; i<a.lenght; i++){
if(++temp!=a[i]){
return ++temp;
}
}
}
transform(String s1, String s2){
for(int i = 0; i<s1.length; i++){
if(s1[i]!=s2[i]){
s1[i]=s2[i];
}
}
}
can you give an example with correct, incorrect cases?
- kamoliddin September 27, 2012create a hashtable from [2,3,5,9,199,200,344] list
while(true){
int num = random(1,n);
if(!hashtable.contains(num))
echo num;
}
this depends on what inside the list,
if coding in java then it really depends on equal+hashcode implementations. if it is just primitive types like int then u are right.
sieve of eratosthenes comes handy.
boolean isPrime(long n) {
if(n < 2) return false;
if(n%2 == 0 || n%3 == 0) return false;
long sqrtN = (long)Math.sqrt(n)+1;
for(long i = 6L; i <= sqrtN; i += 6) {
if(n%(i-1) == 0 || n%(i+1) == 0) return false;
}
return true;
}
Impls is copied from stackoverflow(good impl).
You can read the algorithm wiki
2nd way is to use hashtable, not good way as Tortoise and Hare Algorithm
Create hashtable and start pulling item from linkedList one-by-one and put it inside hashtabe. Before putting it check if it is exist in hashtable, if yes, then you are done. You came to the object where cycle started.
what is complexity for Remove(n), insert(n)?
- kamoliddin June 21, 2012there was a load balancer and and many servers, balancer will dispatch request to servers. I am asked to design the methods.
- kamoliddin June 21, 2012I knew the sorting algorithm u mentioned, I did not focus on 10 bit, and went to wrong direction.
- kamoliddin June 21, 2012Amazing answer, just amazing. I could not come up with that, I lost my job probably on it.
- kamoliddin June 21, 2012what is the difference folder and file? It does not matter. the absolute path is important. I came up with stack too. actually path may contain ./ this too. It does not mean anything. We can skip it.
- kamoliddin June 21, 2012
why we can not do this one, simple basic appreach:
- kamoliddin January 23, 2013table: USER_FRIENDS
columns: user_id friend_user_id
user_id, friend_user_id columns together will be unique and they both will be FK for USERS table.
is it much compilicated, or will be slow?