Bomberman lives in a rectangular grid. Each cell in the grid either contains a bomb or nothing at all. Each bomb can be planted in any cell of the grid but once planted, it will detonate after exactly 3 seconds. Once a…
We define to be a permutation of the first natural numbers in the range . Let denote the value at position in permutation using -based indexing. is considered to be an absolute permutation if holds true for every…
Madison, is a little girl who is fond of toys. Her friend Mason works in a toy manufacturing factory . Mason has a 2D board of size with rows and columns. The board is divided into cells of size with each cell indicated…
Given a 2D array of digits or grid, try to find the occurrence of a given 2D pattern of digits. For example, consider the following grid: 1234567890 0987654321 1111111111 1111111111 2222222222 Assume we need to look for…
Given the time in numerals we may convert it into words, as shown below: At , use o' clock. For , use past, and for use to. Note the space between the apostrophe and clock in o' clock. Write a program which prints the…
Lexicographical order is often known as alphabetical order when dealing with strings. A string is greater than another string if it comes later in a lexicographically sorted list. Given a word, create a new word by…
An English text needs to be encrypted using the following encryption scheme. First, the spaces are removed from the text. Let be the length of this text. Then, characters are written into a grid, whose rows and columns…
David has several containers, each with a number of balls in it. He has just enough containers to sort each type of ball he has into its own container. David wants to sort the balls using his sort method. As an example…
You will be given a square chess board with one queen and a number of obstacles placed on it. Determine how many squares the queen can attack. A queen is standing on an chessboard. The chess board's rows are numbered…
Given a set of distinct integers, print the size of a maximal subset of where the sum of any numbers in is not evenly divisible by . For example, the array and . One of the arrays that can be created is . Another is…
The factorial of the integer , written , is defined as: Calculate and print the factorial of a given integer. For example, if , we calculate and get . Function Description Complete the extraLongFactorials function in…
Let's dive into decorators! You are given mobile numbers. Sort them in ascending order then print them in the standard format shown below: The given mobile numbers may have , or written before the actual digit number…
Molly is in love with Sherlock. She wants to decide the nature of the relationship between her and Sherlock using the game of FLAME. FLAME stands for: {“Friendship”,”Love”,”Affection”,”Marriage”,”Enemies”} The rules of…
There is a street by the name of a colorful street in Pretty Town. The residents of the house have decided that they will paint their houses in either Pink, Orange, or Yellow color and not other. They have also decided…
Josh owns a hotel, there are X rooms in the hotel and every room can be allocated to maximum 1 person at a time. If a customer arrives and there are no rooms available, the customer will leave the hotel without staying…
You are given an array of integers, , and a positive integer, . Find and print the number of pairs where and + is divisible by . For example, and . Our three pairs meeting the criteria are and . Function Description…
After setting up the area and his toys. Chandu is up for playing his very first game. His first game is played on a N X N board with some initial stones placed on each cell. He can move each stone in all four direction…
A string is said to be a special string if either of two conditions is met: All of the characters are the same, e.g. aaa. All characters except the middle one are the same, e.g. aadaa. A special substring is any…
Exceptions Errors detected during execution are called exceptions. Examples: ZeroDivisionError This error is raised when the second argument of a division or modulo operation is zero.>>> a = '1'>>> b = '0'>>> print…
It's New Year's Day and everyone's in line for the Wonderland rollercoaster ride! There are a number of people queued up, and each person wears a sticker indicating their initial position in the queue. Initial positions…