killdos
BAN USER- 0of 0 votes
AnswersFind the value of (x, y) in Pascal's triangle. I wrote code to construct the Pascal's triangle upto the required (x, y). Then interviewer asked me to change code so that I dont have to calculate the whole triangle but only the necessary parts.
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
For example, in order to calculate f(4, 1) which is 4, we only need to calculate f(3, 0) and f(3, 1). And for f(3, 1) we need to calculate f(2, 0) and f(2, 1) and so on. After getting the hint, I wrote the recursive code and then he asked my for complexity of the code.
- killdos in United Statesint pascals(int x, int y){ if(x == 0 or x == y) return 1; return(pascals(x - 1, y) + pascals (x- 1, y - 1); }
| Report Duplicate | Flag | PURGE
Walmart Labs Java Developer - 0of 0 votes
AnswersImplement pow(x, y) which should return x^y. Both iterative and recursive.
- killdos in United States| Report Duplicate | Flag | PURGE
Walmart Labs Java Developer - 0of 0 votes
AnswersPrint all permutations of a string and give the complexity of the algorithm.
- killdos in United States| Report Duplicate | Flag | PURGE
Walmart Labs Java Developer - 0of 0 votes
AnswersDesign database schema for the following problem:
- killdos in United States
You have a website that allows user to download some content. You have to enforce a limit of say 10 items per day for a user. So a user cannot download more than 10 items per 24 hours.
And download counters for users are not reset at 00:00 am because that would allow users to download 10 items between 11 and 12 at night one day and download another 10 items between 12 and 1 the same night. This violates the condition.| Report Duplicate | Flag | PURGE
Ebay Java Developer - 0of 0 votes
AnswersIs it possible to implement singelton pattern in JS. If it is how would you do it?
- killdos in United States| Report Duplicate | Flag | PURGE
Ebay Java Developer