Section 1 - Maximum OR (Coding, 20 mins)
Problem Statement: Given an array arr of n integers, in a single operation, choose any integer in the array and multiply it by 2.
Given arr and an integer num_operations, find the maximum bitwise OR of all the element of the array after performing the operations exactly num_operations times.
Example: n = 2, arr = [12, 9] and num_operations = 1
It is optimal to perform the operatino on 9 to get the array [12, 18]. The bitwise OR of the array is 1100 OR 10010 = 11110 which is the binary representation of 30, hence the answer is 30.
Section 2 - Chocolate Shop (Coding, 30 mins)
Problem statement: Mary wants to buy some chocolates from a shop. The chocolates in the shop are marked in lowercase english alphabets ('a' to 'z'). Also the shop has divided it's chocolates in to small sets, and assigns a unique set to each customer. Customers can buy chocolates from set s using the below given methods.
- Method 1: Buy the enitre set at once
- Method 2: Buy the first i chocolates in the est, i.e. s[1: i] when s[1:i] = s[i+1 : 2i] (where 1 <= i < i+1 <= 2i <= length of s). This mean substring s[i+1 : 2i] and prefix s[1: i] are identical
The given set can be bought in multiple steps. And in each step, either of the methods mentioned above can be used. The more the number of steps, the more is the discount a customer can avail. Help Mary to compute the maximum number of steps required to buy the entire set of chocolate.
Example:
- Input - abbabb
- Output - 2
- Explanation - setp1: Prefix "abb" is bought according to method 2
step 2: no other identical substring can be formed, hence remaining string "abb" is bought acc to method 1
Section 3 - Disconnected Nodes (Coding, 30 mins)
Problem statement: there is an undirected graph with n nodes and some edges, there is also an array of m integers disconnected_nodes, which represnt the array of nodes that are not reachable from one another via any path. No two nodes in the array are connected directly or indirectly.
Find the maximum number of edges that can be added to the graph such that the set of disconnected_nodes remains disconnected.
Example:
Input - n = 6, edges = [[1,2], [1,3], [2,3], [4,5]], disconnected_nodes = [2, 4]
output - 3
Explanation - following edges can be added [6,1] , [6,2], [6,3]
Section 4 - 10 MCQ on CS Fundamentals of 20 mins
Questions were very basic and easy
Section 5 - 10 MCQ on Aptitude of 20 mins
Questions were a mix of easy, medium and difficult as well