You are on page 1of 4

Li-Mat Soft Solutions Pvt. Ltd.

Pradipto Chatterjee

DSA Questions
Pre-assessment Test
Instructions: Use your favourite programming language to implement the following
questions. You can take user input or initialize the data structures directly in your program. Your
task in to implement the logic to solve the following problems.

1. Given an array of integers (A[]) and a number x, find the smallest subarray with
sum greater than the given value.

2. Median of two sorted arrays of different sizes.


Li-Mat Soft Solutions Pvt. Ltd. Pradipto Chatterjee

3. Given three integers 'A' denoting the first term of an arithmetic sequence , 'C'
denoting the common difference of an arithmetic sequence and an integer 'B'.
you need to tell whether 'B' exists in the arithmetic sequence or not.

4. Minimum swap required to convert binary tree to binary search tree.

5. Reverse a linked list (Pre-defined or user input both are allowed).


6. Given 3 strings A, B and C, the task is to find the longest common sub-sequence
in all three given sequences i.e. Find the longest sequence which can be
obtained from the first original sequence by deleting some items and from the
second original sequence by deleting other items. The problem differs from the
problem of finding the longest common substring. Unlike substrings,
subsequences are not required to occupy consecutive positions within the
original string.
Example:
X: ABCBDAB
Y: BDCABA
Z: BADACB

The length of the LCS is 4, and the LCS is BDAB.


Li-Mat Soft Solutions Pvt. Ltd. Pradipto Chatterjee

7. M-Coloring Problem: Given an undirected graph and an integer M. The task is


to determine if the graph can be colored with at most M colors such that no two
adjacent vertices of the graph are colored with the same color. Here coloring of a
graph means the assignment of colors to all vertices. Print 1 if it is possible to
colour vertices and 0 otherwise.

8. The problem is to print all the possible paths from top left to bottom right of a
mXn matrix with the constraints that from each cell you can either move only to
right or down.

9. Equilibrium index of an array is an index such that the sum of elements at lower
indexes is equal to the sum of elements at higher indexes.
Write a function int equilibrium(int[] arr, int n) that given a sequence arr[] of
size n, returns an equilibrium index (if any) or -1 if no equilibrium indexes exist.
For example, in an array A:
Li-Mat Soft Solutions Pvt. Ltd. Pradipto Chatterjee

10. There is a given array and split it from a specified position, and move the first
splitted part of the array and then add to the end of array.

You might also like