Given a decimal number, convert the decimal number to its binary representation.

# SCHOOL OF CODE BUILDERS

Learn To CODE. Become A DEVELOPER.

### Python program to add n numbers

Given 'n' integers space separated, add the numbers and print the sum.

### Python program to multiply two matrices

Given size N (N x N), matrix A and matrix B, multiply the two matrices and print the resultant matrix.

### Python program to add two matrices

Given size N, for NxN and Matrix A, Matrix B, perform the sum of two matrices and print the resultant matrix.

### Arjit and Printing Press : HackerEarth Problem Solution

Arjit has his own printing press, Bainik Dhaskar (BD). He feels that words on their own simply aren't beautiful enough. So, he wishes to make a Super Manuscript (SM) machine. Now what does this machine do?

The SM machine aims to make words as beautiful as they can be by making a word as lexicographically small as possible. Arjit, being the resourceful person he is, has a reserve string from which we can choose characters that will replace characters in the original word that BD's SM machine wishes to transform.

Keep in mind that once you have used a letter in the reserve string, it is removed from the reserve.

As Arjit is busy with other work at BD, it's your work to take care of programming SM :)

Note that you cannot modify the original order of the letters in the word that has to be transformed. You can only replace its letters with those in the reserve.

The SM machine aims to make words as beautiful as they can be by making a word as lexicographically small as possible. Arjit, being the resourceful person he is, has a reserve string from which we can choose characters that will replace characters in the original word that BD's SM machine wishes to transform.

Keep in mind that once you have used a letter in the reserve string, it is removed from the reserve.

As Arjit is busy with other work at BD, it's your work to take care of programming SM :)

Note that you cannot modify the original order of the letters in the word that has to be transformed. You can only replace its letters with those in the reserve.

### Speed : HackerEarth Problem Solution

Rash is known about his love for racing sports. He is an avid Formula 1 fan. He went to watch this year's Indian Grand Prix at New Delhi. He noticed that one segment of the circuit was a long straight road. It was impossible for a car to overtake other cars on this segment. Therefore, a car had to lower down its speed if there was a slower car in front of it. While watching the race, Rash started to wonder how many cars were moving at their maximum speed. Formally, you're given the maximum speed of N cars in the order they entered the long straight segment of the circuit. Each car will prefers to move at its maximum speed. If that's not possible because of the front car being slow, it might have to lower its speed. It still moves at the fastest possible speed while avoiding any collisions. For the purpose of this problem, you can assume that the straight segment is infinitely long. Count the number of cars which were moving at their maximum speed on the straight segment.

### Maximum AND : HackerEarth Problem Solution

Given two numbers A and B. Find the value of pair (P,Q) such that A <= P < Q <= B value of P AND Q is maximum where AND is a binary operator.

### Monk's Choice of Numbers : HackerEarth Problem Solution

Monk loves cakes! He visits the Binary Bakery to buy some of his favorite cheesecakes.

The owner of the bakery, Bob, is a clever man. He does not want Monk to finish all his cheesecakes. Hence, he plays a game.

The Monk is given N numbers and has to select K of these numbers. For each number that Monk chooses, he will get as many cheesecakes as the number of 1's in the Binary representation of the number i.e. the number of bits that are set.

Help Monk find the maximum number of cakes that he can have.

The owner of the bakery, Bob, is a clever man. He does not want Monk to finish all his cheesecakes. Hence, he plays a game.

The Monk is given N numbers and has to select K of these numbers. For each number that Monk chooses, he will get as many cheesecakes as the number of 1's in the Binary representation of the number i.e. the number of bits that are set.

Help Monk find the maximum number of cakes that he can have.

### The Magic : HackerEarth Problem Solution

Navi got a task at school to collect N stones. Each day he can collect only one stone. As N can be a very large number so it could take many days to complete the task, but then he remembers that his mother gave him a magic that can double anything (i.e if he has 2 stones, the magic will make them to 4 stones). Navi can use this magic any number of time on the collected stone on a particular day and add this to the previously collected stones. Remember that he wants exactly N stones and he can't throw any stone. If he gets more than N stones then he gets 0 marks, of course he doesn't want 0 marks. Help him to collect exactly N stones in minimum number of days.

### Death, the Multiverse and Nothing : HackerEarth Problem Solution

You'll be given an array AA of NN integers as input. For each element of the array A[i]A[i], print A[i]−1A[i]−1.