You are on page 1of 3

Please do not use any built in libraries or ready available methods or

functions to solve these problems.

Problem 1:
You are playing an online game. In the game, a list of N numbers is given. The player
has to arrange the numbers so that all the odd numbers of the list come after the even
numbers in ascending order. Write an algorithm to arrange the given list such that all the odd
numbers of the list come after the even numbers.
Input
The first line of the input consists of an integer num, representing the size of the list(N). The
second line of the input consists of N space-separated integers representing the values of the
list
Output
Print N space-separated integers such that all the odd numbers of the list come after the even
numbers

Test case:
Input
8
10 98 3 33 12 22 21 11
Output
10 12 22 98 3 11 21 33
Problem 2:
A washing machine works on the principle of the Fuzzy System, the weight of clothes
put inside it for washing is uncertain. But based on weight measured by sensors, it decides
time and water level which can be changed by menus given on the machine control area.

For low level water, the time estimate is 25 minutes, where approximately weight is between
2000 grams or any nonzero positive number below that.

For medium level water, the time estimate is 35 minutes, where approximately weight is
between 2001 grams and 4000 grams.

For high level water, the time estimate is 45 minutes, where approximately weight is above
4000 grams.

Assume the capacity of machine is maximum 7000 grams

Where approximately weight is zero, time estimate is 0 minutes.

Write a function which takes a numeric weight in the range [0,7000] as input and produces
estimated time as output and for all other inputs, the output statement is

“INVALID INPUT”.

Input should be in the form of integer value –

Output must have the following format –Time Estimated: Minutes

Test case :

Input

2000

Output

Time Estimated: 25 minutes


Problem 3:
Given a 2D array, print it in spiral form. See the following examples.
Example:

Input: 1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16

Output: 1 2 3 4 8 12 16 15 14 13 9 5 6 7 11 10
Explanation: The output is matrix in spiral format.

Problem 4:
Multiply two 4 X 4 matrix

Problem 5:

The Caesar cipher is a type of substitution cipher in which each alphabet in the
plaintext or messages is shifted by a number of places down the alphabet.

For example,with a shift of 1, P would be replaced by Q, Q would become R, and so on.

To pass an encrypted message from one person to another, it is first necessary that both
parties have the ‘Key’ for the cipher, so that the sender may encrypt and the receiver may
decrypt it.

Key is the number of OFFSET to shift the cipher alphabet. Key can have basic shifts from 1
to 25 positions as there are 26 total alphabets.

Test case:

Input

Enter your PlainText: All the best

Enter the Key: 1

Output

The encrypted Text is: Bmm uif Cftu

You might also like