the first was a coding round on hacker rank ide, there was 2 questions to be answered in 90 minutes.
Question 1 : there are switches that can be controlled by a remote , n such switches are connected in series and at the end of there is a bulb , the remote has a button that toggle the state of the switch (on to off and vice versa) , but the remote only works in switches which have a electric connection to them , A switch is connected when when all the previous switches are turned ON, and the bulb is on when all the switches are ON , At first all the switches are off and only the first switch is connected ,
Input- N (number of switches ) ,1 < N < 30
K(number of times the button is pressed) 1 < k < 10^7 output – 1 (if the bulb is on) , -1 (if it’s not) hint : figure out a simple math formula where the ans is 1 for value of K is k = p* pow(2, N) – 1 [for all p > 1 and p*pow(2,N) < K ].
Question 2 : there are N employee sitting in consecutive cubicles , we have to send a few of them to onsite , but each time we send one employee onsite , his cubicle becomes empty , now the other employees from both side of that empty cubicle stops working until they are given a gift .
the gifts are given in both sides of the empty cubicle until we reach the end or found another cubicle ,
Input – number of cubicle , and index numbers of people to be sent
output- min number of gifts needed
hint: we have to find the order in which we will sent the people on site , find the index that’s in the middle or near about middle and send him out , keep doing the same for left and right sub array , there are many other ways of doing this by using binary trees .
If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
- Infosys Interview Experience for Specialist Profile
- Infosys Power Programmer Role Interview Experience
- SAP Labs Interview Experience | Set 10 (For Developer Specialist, 4-6 yrs)
- Google Interview Experience | Set 1 (for Technical Operations Specialist [Tools Team] Adwords, Hyderabad, India)
- Infosys Interview Experience | Set 4 (On-Campus)
- Infosys Interview Experience (BIT Mesra)
- Infosys Interview Experience (HackWithInfy)
- Infosys Interview Experience (On-Campus for System Engineer)
- Bloomberg Interview | Set 3 (For Software Development Programmer)
- Infosys Campus Placement Experience | Set 5
- Infosys Campus Placement Experience | Set 6
- Infosys Campus Placement Experience
- How to face Infosys Interview?
- Infosys's most asked interview questions
- Goldman Sachs Interview Experience | Set 23 (2+ years Experience for Java Developer Role)