Directi Online Coding Test Placement Papers Interview Questions
Directi is a group of Businesses that develop innovative mass-market Web Products serving millions of Customers worldwide. Directi rank amongst the fastest growing businesses worldwide in their corresponding industry segments.
Skills Required: Acquainted with / have mastered a few of the skills/tools like Java, C#, PHP, Ruby, Python, C++, JavaScript, WPF, LISP, Linux, Flex, Bash, Advanced Networking, Async IO, etc.
Selection Process of Directi:
Online Coding Round: It has 3 questions, 90 minutes, Test Platform is Codechef. You have to be fluent with problem solving on code chef to crack this round. There is no restriction or penalty to the number of submissions you make for a problem. The last correct solution will be considered by the system. Language of coding will your choice.
Here your code has to satisfy all the test cases mentioned, which is quite difficult, if you satisfy more test cases it means more points you got.
1. Maximum Sub Array
Find out the maximum sub-array of non-negative numbers from an array. The sub-array should be continuous. That is, a sub-array created by choosing the second and fourth element and skipping the third element is invalid.
Maximum sub-array is defined in terms of the sum of the elements in the sub-array. Sub-array A is greater than sub-array B if sum (A) > sum (B).
NOTE 1: If there is a tie, then compare with segment's length and return segment which has maximum length
NOTE 2: If there is still a tie, then return the segment with minimum starting index.
Input: The first line contains the number of test cases. Each test cases contains an integer N. next line consists of N integers, the elements of the array.
Output: Print out the maximum sub-array as stated above.
Constraints 1 ≤ T ≤ 100 1 ≤ N ≤ 105 1 ≤ Ai ≤ 105
Example Input:
1
6
1 2 5 -7 2 3
Output: 1 2 5
2.Modification of stock buy and sell problem: The question was modified as every time you buy or sell share you have to give k amount as fee. This can be solved using DP
3. Limak is a grizzly bear who desires power and adoration. He wants to win in upcoming elections and rule over the Bearland.
There are n candidates, including Limak. We know how many citizens are going to vote for each candidate. Now i-th candidate would get ai votes. Limak is candidate number 1. To win in elections, he must get strictly more votes than any other candidate.
Victory is more important than everything else so Limak decided to cheat. He will steal votes from his opponents by bribing some citizens. To bribe a citizen, Limak must give him or her one candy - citizens are bears and bears like candies. Limak doesn't have many candies and wonders - how many citizens does he have to bribe?
Input:
The first line contains single integer n (2 ≤ n ≤ 100) - number of candidates.
The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 1000) - number of votes for each candidate. Limak is candidate number 1.
Note: that after bribing number of votes for some candidate might be zero or might be greater than 1000.
Output: Print the minimum number of citizens Limak must bribe to have strictly more votes than any other candidate.
Examples:
input
5
5 1 11 2 8
output
4
input
4
1 8 8 8
output
6
input
2
7 6
output
0
Note: In the first sample Limak has 5 votes. One of the ways to achieve victory is to bribe 4 citizens who want to vote for the third candidate. Then numbers of votes would be 9, 1, 7, 2, 8 (Limak would have 9 votes). Alternatively, Limak could steal only 3 votes from the third candidate and 1 vote from the second candidate to get situation 9, 0, 8, 2, 8.
In the second sample Limak will steal 2 votes from each candidate. Situation will be 7, 6, 6, 6.
In the third sample Limak is a winner without bribing any citizen.
Algorithm Round: 3 Algorithm rounds, 45 minutes each, each candidate will have to clear any 2 of the 3 rounds to qualify further. In each algorithm round there will be one question and you have to code and solve the given question.
Algorithm round questions of Directi:
1. An array of n numbers is given, find maximum sum of 2 contiguous sub arrays each of k length such that both sub array are not overlapping. I had to provide most efficient algorithm.
2. You are given a string x=“A”. In each step you have to replace A with BA and B with AB in string x. You have to find the number of substring “BB” in string x after n steps.
Final Round: Technical cum HR Assessment, 60 minutes Each round will be an elimination based.
Skills Required: Acquainted with / have mastered a few of the skills/tools like Java, C#, PHP, Ruby, Python, C++, JavaScript, WPF, LISP, Linux, Flex, Bash, Advanced Networking, Async IO, etc.
Selection Process of Directi:
Online Coding Round: It has 3 questions, 90 minutes, Test Platform is Codechef. You have to be fluent with problem solving on code chef to crack this round. There is no restriction or penalty to the number of submissions you make for a problem. The last correct solution will be considered by the system. Language of coding will your choice.
Here your code has to satisfy all the test cases mentioned, which is quite difficult, if you satisfy more test cases it means more points you got.
Coding Test Questions of Direci:
1. Maximum Sub Array
Find out the maximum sub-array of non-negative numbers from an array. The sub-array should be continuous. That is, a sub-array created by choosing the second and fourth element and skipping the third element is invalid.
Maximum sub-array is defined in terms of the sum of the elements in the sub-array. Sub-array A is greater than sub-array B if sum (A) > sum (B).
NOTE 1: If there is a tie, then compare with segment's length and return segment which has maximum length
NOTE 2: If there is still a tie, then return the segment with minimum starting index.
Input: The first line contains the number of test cases. Each test cases contains an integer N. next line consists of N integers, the elements of the array.
Output: Print out the maximum sub-array as stated above.
Constraints 1 ≤ T ≤ 100 1 ≤ N ≤ 105 1 ≤ Ai ≤ 105
Example Input:
1
6
1 2 5 -7 2 3
Output: 1 2 5
2.Modification of stock buy and sell problem: The question was modified as every time you buy or sell share you have to give k amount as fee. This can be solved using DP
3. Limak is a grizzly bear who desires power and adoration. He wants to win in upcoming elections and rule over the Bearland.
There are n candidates, including Limak. We know how many citizens are going to vote for each candidate. Now i-th candidate would get ai votes. Limak is candidate number 1. To win in elections, he must get strictly more votes than any other candidate.
Victory is more important than everything else so Limak decided to cheat. He will steal votes from his opponents by bribing some citizens. To bribe a citizen, Limak must give him or her one candy - citizens are bears and bears like candies. Limak doesn't have many candies and wonders - how many citizens does he have to bribe?
Input:
The first line contains single integer n (2 ≤ n ≤ 100) - number of candidates.
The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 1000) - number of votes for each candidate. Limak is candidate number 1.
Note: that after bribing number of votes for some candidate might be zero or might be greater than 1000.
Output: Print the minimum number of citizens Limak must bribe to have strictly more votes than any other candidate.
Examples:
input
5
5 1 11 2 8
output
4
input
4
1 8 8 8
output
6
input
2
7 6
output
0
Note: In the first sample Limak has 5 votes. One of the ways to achieve victory is to bribe 4 citizens who want to vote for the third candidate. Then numbers of votes would be 9, 1, 7, 2, 8 (Limak would have 9 votes). Alternatively, Limak could steal only 3 votes from the third candidate and 1 vote from the second candidate to get situation 9, 0, 8, 2, 8.
In the second sample Limak will steal 2 votes from each candidate. Situation will be 7, 6, 6, 6.
In the third sample Limak is a winner without bribing any citizen.
Algorithm Round: 3 Algorithm rounds, 45 minutes each, each candidate will have to clear any 2 of the 3 rounds to qualify further. In each algorithm round there will be one question and you have to code and solve the given question.
Algorithm round questions of Directi:
1. An array of n numbers is given, find maximum sum of 2 contiguous sub arrays each of k length such that both sub array are not overlapping. I had to provide most efficient algorithm.
2. You are given a string x=“A”. In each step you have to replace A with BA and B with AB in string x. You have to find the number of substring “BB” in string x after n steps.
Final Round: Technical cum HR Assessment, 60 minutes Each round will be an elimination based.
Directi Online Coding Test Placement Papers Interview Questions
Reviewed by Placement Papers Hub
on
5:51:00 PM
Rating:
No comments: