

You have to find room numbers from where you will start and from where you will exit. Given several rooms (N), and several gold coins in N rooms. The owner wants to have exactly K coins, when you exit the room, he guarantees that there will be at least one possible solution for this puzzle. While visiting any room you will collect all the gold coins, and if you enter any room then you can’t skip collecting gold coins from that room, you have to take those coins. From any room either you can exit, or you can move to the next room. You have to choose two rooms, one from where you will enter and the other one from where you will exit. The owner of the house kept some number of golden coins in each room. The person who will be able to solve that puzzle will be the manager of the golden house. The owner of this house wanted an intelligent manager for this role, so he created one puzzle within that golden house. As you have been unemployed for a long time, you are interested in this job. There are N rooms in this golden house and its owner needs someone to take care of the management of this house. This vacation you went to visit the golden house. Second Input: It will contain N integers, each separated.First Input: It will contain two integers N (number of horses) and K (reward money).
#Bits and pieces puzzles 1000 pieces code#
The candidate has to write the code to accept 2 inputs. And the max length of the sequence will be 1. So, Bob will choose randomly any one horse. Explanation: There are no two consecutive horses for which the sum of price is less than 100.As none of the other sequences with a length greater than 3 will have a price less than 100 so the answer will be 3. Bob will choose randomly one sequence from these two. There are two possible o sequences of length three whose total money for betting is less than 100, i.e. Explanation: There are 10 horses, and the reward money is 100.Hint: For each starting index of a horse, its end index in sequences will be equal to or greater than the end index of the previous starting index. Given the number of horses(N), reward money(K), and price of betting on N horses in order. If there is more than one possible combination, Bob will bet randomly on any one of them. As you are his best friend, he reached out to you for help, can you please find the length of the maximum continuous sequence of horses on which Bob can make a bet, and remember he will invest money less than K units. Bob wants to bet on as many horses as he can. But as the award is only K units so he wants to put money less than K. Bob will get K units of money if any horse on which he bets will win. There is no limit on the number of horses on which he can bet, but he thinks that if he bets on a continuous sequence of horses then he has a better chance to win. The probability of winning each horse is different so the prices for making a bet on the horses are not the same. There are N horses listed in a sequence of 1 to N. denoting digit understanding by N friends Output: 0 Explanation: All of them understood the digits correctly.Įxample 2: 5 1 2 3 2 2 Output: 4 Explanation: 1st, 2nd, 3rd, and 4th friends could not enact OR understand the enactment.īob is going to bet today on horse riding. finds out how many of Alice’s friends have not enacted well OR did not understand the enactment by the previous friend correctly.Įxample 1: 3 -> N, number of friends 4 4 4 – array D. Given N number of friends and digit array D, denoting the digit understood by each friend F. However, if the digits do not match, Alice will ask each friend’s digits, and she will offer the T-shirts to only those who understood the digits correctly. If the digits are similar then, Alice will give a T-shirt to each friend.

Finally, the last person will write the digit on a separate paper and give it to Alice to compare both papers.

This continues until the last person F understands the digit. Similarly, F will communicate to the next person i.e., F. After receiving the paper with a digit, F will enact and try to tell F without speaking. F…F represents friends seated respectively. Let’s denote friends by F, where F will be of size N. Alice starts by providing a paper with a single-digit number to the friend present at number 1. Alice is acting as a mediator, and the rest of the N friends are seated on N chairs, one each. Alice and her friends are playing a game of verbal Kho-Kho.
