**Round 1:coding round(3 coding questions) on Hackerrank platform**

(1)**Split the array**

There is an array val of n integers. A good sub-array is defined as: •

-Sub-array *val[i to j]* is a ‘good sub-array only if *gcd(val[i], val[j])>* 1 (where 0<=i<=j<n).

Split the whole array in such a way that each split sub-array is a ‘good’ one and the value of each element in the array val, belongs to exactly one sub-array.

calculate the minimum number of split sub-arrays with each being a’good sub-array’.

Note:

.*gcd(a, b)= Greatest common divisor of two numbers a and b.*

**(2)Final Discount Price**

A shopkeeper has a sale to complete and has arranged the items being sold in an array. Starting From the left, the shopkeeper rings up each item at its full price less the price of the first lower or equal priced item to its right. If there is no item to the right that costs less than or equal to the current item’s price, the current item is sold at full price.

For example, assume there are items priced [2, 3, 1, 2, 4, 2]

• The items 0 and 1 are each discounted by 1 unit, the first equal or lower price to the right.

• Item 2, priced 1 unit sells at full price because there are no equal or lower priced items to the right.

• The next item, item 3 at 2 units, is discounted 2 units, as would the item 4 at 4 units.

• The final item 5 at 2 units must be purchased at full price because there are no lower prices to the right.

The total cost is *1+2+1+0+2+2=8* units. The full price items are at indices [2, 5] using* 0* based indexing.

**(3)Circular trail**

As part of his training, Rock Lee will run on a trail of length n labeled From 1 to n. His coach gives him a starting and ending point. Usually, he runs m segments every day. According to Mighty Guy’s instructions, in ith segment, Rock Lee has to start his run From spot[i] and end at spot[i+1](where 0<=i < m-1). The trail is circular, so if spot[i+1]<spot[i], he has to run past the last marker and continue running From marker 1 until he reaches spot[i-1]. On each segment, Rock Lee visits each marker From beginning to end of the segment. Find the most Frequently visited spot in the entire circular trail. If there are multiple markers with the same number of visits, choose the smallest one.

For example, given a track or length n =3, and 3 segments to run ending at spot = [3, 3, 2], on the first segment, Rock Lee visits spots 1, 2, and 3. On the second segment, he visits spots 3, 1, 2, 3, and on the third segment he visits 3, 1, 2. He has visited spot 3 the most times, with a visit count of 4.

**Round 2:coding round(3 coding questions) on Hackerrank platform**

**(1)Mystery value**

You are given a sequence x, consisting of 2^n non-negative integers: x1, x2, …, X2^n.

You have to find the mystery value in the given sequence.

The process to find the mystery value uses the operations alternatively as described below:

* Add operation* –

This operation adds the adjacent elements of the given sequence starting from the first element in pairs of two.

Eg.(x1+ x2), (x3+ x4)….. (x2^n-1+ x2^n) .

[**Note**:Elements in the pairs formed need to be mutually exclusive about the other pairs]

This operation yields a new sequence of length 2^n-1.

**Subtract Operation-**

This operation subtracts the adjacent elements of the sequence that is obtained after performing the add operation as shown below.

[ **Note**:The |x| represents the absolute value of x]

[ **Note**:The pairing of the elements takes place From left to right starting from the first element of the sequence mentioned above in pairs of two]

**The mystery value is found by performing the Add Operation and Subtract Operation alternatively. The first operation to be performed is always an Add Operation.**

These operations are performed until only one value remains. The value thus obtained is called the mystery value.

**(2)Optimal Tower**

A graph representing terrain has been provided. Radio towers need to be placed in an optimal manner on peaks such that a message can reach the end of the terrain.

A tower can be of any height, and can only be placed on the top of any peak .

**[ Note: A peak is defined as a point that is greater than both is adjacent points if they exists ].**

Given that a signal is sent from the left side of the graph towards the right. The signal can only move horizontally towards the right. Any signal can only propagate k units without needing a tower to boost the signal again, find the minimum number of towers required for a signal that originates on the left side of the graph to reach the right side.

You are given the height values of the terrain from left to right in the form of an array.

**Note**:The starting and ending points of the graph are considered as being neither peaks nor towers.

**(3)Science Exhibition**

Charlie is dropping off his nephew Jake at the Science Museum in Malibu.

Charlie tells Jake that he’ll be back to pick Jake up after exactly x minutes.

Since Jake does not want to waste any time, he decides to utilise all the x minutes ( neither more nor less).

There are n exhibition tours going on in the museum, connected by corridors. The entry into the museum is free, but each exhibition tour has a cost. When walking around the museum, Jake will never skip an exhibition when walking past it, even if he has visited it before. He can also visit an exhibition more than once back to back since he’s Fond of them. It is given that walking through the corridors from one exhibition to another takes a given amount of time. Find the minimum amount that has to be spent by Jake while visiting the exhibitions.

[** NOTE:** Jake always starts and ends at exhibition 1, since the entrance is located there]

**Round 3:Technical and HR interview .**

(1)Tell me about yourself?

(2)Secondly interviewer asked me about my projects

(3) What is method overloading and method overriding and write code for it?

(4)Find factorial of a number.

(5)Write SQL query find third maximum salary from employee table

(6)What is normalisation and their types explain it.

HR questions:-

(1)What are your strengths and Weaknesses?

(2)What are your Hobbies?

(3)3rd and last Why should i hire you?

and finally got selected as system engineer specialist