This article on Directi Placement Papers will focus mainly on the level of Online test that Directi uses to choose its candidates for the final round.
The first two rounds, i.e MCQ Round and Coding Round are the termination rounds. If the candidate is able to clear this part of Directi Placement Papers, there is a high chance for him/her to get selected by the company.
In Directi Placement Process several rounds are ramified:
This round of Directi Placement Papers is specifically regulated for the hiring of Operation Engineers and comprises of about 20 questions related to Operating Systems, Computer Networks, Algorithms and Data Structure, and general aptitude.
Some of the questions asked in this round of Directi Placement Papers:
This coding round of Directi Placement Papers is an online coding round organized on CodeChef and generally includes of 2 to 3 questions. In this round one needs to go through maximum successful test cases to go to the next technical rounds.
Few questions which can be asked in this round of Directi Placement Papers or one can refer to are as follows:
For building up your skills in technical you can take help of the below-listed links:
1. Given two arrays of integers arr and P such that after a cycle an element arr[i] will be at location arr[P[i]]. The task is to find the minimum number of cycles after that all the elements of the array have returned to their original locations.
Answer
Input : arr[] = {1, 2, 3}, P[] = {3, 2, 1}
Output : 2
After first move array will be {3, 2, 1}
after second move array will be {1, 2, 3}
Input : arr[] = {4, 5, 1, 2, 3}, P[] = {1, 4, 2, 5, 3}
Output : 4
2. There is a m*n rectangular matrix where the top-left(start) location is (1, 1) and bottom-right(end) location is (m*n). There are k circles in which each has radius r. If there is any path from start to end without touching any circle then find it out.
The input has values of m, n, k, r and two array of integers X and Y, each of length k. (X[i], Y[i]) is the centre of ith circle.
Answer
Input1 : m = 5, n = 5, k = 2, r = 1,
X = {1, 3}, Y = {3, 3}
Output1 : Possible
Here is a path from start to end point.
Input2 : m = 5, n = 5, k = 2, r = 1,
X = {1, 1}, Y = {2, 3}.
Output2 : Not Possible
Solution : Check if the centre of a cell (i, j) of the rectangle comes within any of the circles then do not traverse through that cell and mark that as blocked. Mark rest of the cells initially as unvisited. Then use BFS to find out shortest path of each cell from starting position. If the end cell is visited then we will return Possible otherwise Not Possible
Algorithm :
3.Given n, how many distinct Max Heap can be made from n distinct integers?
Answer
Examples:
Input : n = 3
Output : Assume the integers are 1, 2, 3.
Then the 2 possible max heaps are:
3
/
1 2
3
/
2 1
Input : n = 4
Output : Assume the integers are 1, 2, 3, 4.
Then the 3 possible max heaps are:
4
/
3 2
/
1
4
/
2 3
/
1
4
/
3 1
/
2
Since there is only one element as the root, it must be the largest number. Now we have n-1 remaining elements. The main observation here is that because of the max heap properties, the structure of the heap nodes will remain the same in all instances, but only the values in the nodes will change.
Assume there are l elements in the left subtree and r elements in the right subtree. Now for the root, l + r = n-1. From this we can see that we can choose any l of the remaining n-1 elements for the left sub-tree as they are all smaller than the root.
We know the there are ways to do this. Next for each instance of these, we can have many heaps with l elements and for each of those we can have many heaps with r elements. Thus we can consider them as subproblems and recur for the final answer as:
T(n) = * T(L) * T(R).
Now we have to find the values for l and r for a given n. We know that the height of the heap h = . Also the maximum number of elements that can be present in the h th level of any heap, m = , where the root is at the 0th level. Moreover the number of elements actually present in the last level of the heap p = n ( 1). (since number of nodes present till the penultimate level). Thus, there can be two cases: when the last level is more than or equal to half-filled:
l = 1, if p >= m / 2
(or) the last level is less than half-filled:
l = 1 ((m / 2) p), if p < m / 2
(we get 1 here because left subtree has nodes.
From this we can also say that r = n l 1.
We can use the dynamic programming approach discussed in this post here to find the values of . Similarly if we look at the recursion tree for the optimal substructure recurrence formed above, we can see that it also has overlapping sub problems property, hence can be solved using dynamic programming:
T(7)
/
T(3) T(3)
/ /
T(1) T(1) T(1) T(1)