Mock test Exam Programming

Given a square maze (A) of dimension N, every entry (Aij) in the maze is either an open cell 'O' or a wall 'X'. A rat can travel to its adjacent locations (left, right, top and bottom), but to reach a cell, it must be open. Given the locations of R rats, can you find out whether all the rats can reach others or not.

Read Solution (Total 0)

Mock test Other Question

Zoya has developed a new game called Zombie World. The objective of the game is to kill all zombies in given amount of time. More formally,
· N represents the total number of zombies in the current level

· T represents the maximum time allowed for the current level

· P represents the initial energy level a player starts with

· Ei defines the energy of the i-th zombie

· D defines the minimum energy the player needs, to advance to the next level

In order to defeat a zombie, player energy must be at least equal to the i-th zombie's energy. If the player succeeded in defeating the zombie, then he will be awarded with an additional energy equal to the difference between current zombie energy and the player energy.
One unit of time will be taken to complete the fight with a single zombie.

Rules of the game:-
· At any given time, a player can fight with only one zombie

· Player is allowed to choose any one zombie to fight with.

Your task is to determine whether the player will advance to the next level or not, if he plays optimally.
In a social network, online communities refer to the group of people with an interest towards the same topic.
People connect with each other in a social network. A connection between Person I and Person J is represented as C I J. When two persons belonging to different communities connect, the net effect is merger of both communities which I and J belonged to.
We are only interested in finding out the communities with the member count being an even number. Your task is to find out those communities.