You are given a 2D matrix of dimension and a positive integer . You have to rotate the matrix times and print the resultant matrix. Rotation should be in anti-clockwise direction. Rotation of a matrix is represented by…
A gene is represented as a string of length (where is divisible by ), composed of the letters , , , and . It is considered to be steady if each of the four letters occurs exactly times. For example, and are both steady…
Given an array of integers, determine whether the array can be sorted in ascending order using only one of the following operations one time. Swap two elements. Reverse one sub-segment. Determine whether one, both or…
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: Assume we need to look for the following 2D pattern array: The 2D pattern begins…
Alice is playing an arcade game and wants to climb to the top of the leaderboard and wants to track her ranking. The game uses Dense Ranking, so its leaderboard works like this: The player with the highest score is…
Sherlock considers a string to be valid if all characters of the string appear the same number of times. It is also valid if he can remove just character at index in the string, and the remaining characters will occur…
You will be given an array of integers and a target value. Determine the number of pairs of array elements that have a difference equal to a target value. For example, given an array of [1, 2, 3, 4] and a target value…
Lauren has a chart of distinct projected prices for a house over the next several years. She must buy the house in one year and sell it in another, and she must do so at a loss. She wants to minimize her financial loss…
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…
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…
Given an array of stick lengths, use of them to construct a non-degenerate triangle with the maximum possible perimeter. Print the lengths of its sides as space-separated integers in non-decreasing order. If there are…
In this challenge, you will be given a string. You must remove characters until the string is made up of any two alternating characters. When you choose a character to remove, all instances of that character must be…
You will be given a list of 32 bit unsigned integers. Flip all the bits ( and ) and print the result as an unsigned integer. For example, your decimal input . We're working with 32 bits, so: Function Description…
Consider two -element arrays of integers, and . You want to permute them into some and such that the relation holds for all where . For example, if , , and , a valid satisfying our relation would be and , and . You are…
Jim's Burgers has a line of hungry customers. Orders vary in the time it takes to prepare them. Determine the order the customers receive their orders. Start by numbering each of the customers from to , front of the…
Mark and Jane are very happy after having their first child. Their son loves toys, so Mark wants to buy some. There are a number of different toys lying in front of him, tagged with their prices. Mark has only a certain…
Lena is preparing for an important coding competition that is preceded by a number of sequential preliminary contests. Initially, her luck balance is 0. She believes in "saving luck", and wants to check her theory. Each…
Given a square grid of characters in the range ascii[a-z], rearrange elements of each row alphabetically, ascending. Determine if the columns are also in ascending alphabetical order, top to bottom. Return YES if they…
Marc loves cupcakes, but he also likes to stay fit. Each cupcake has a calorie count, and Marc can walk a distance to expend those calories. If Marc has eaten cupcakes so far, after eating a cupcake with calories he…
Consider an array of integers, . We define the absolute difference between two elements, and (where ), to be the absolute value of . Given an array of integers, find and print the minimum absolute difference between any…