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…
You are planning production for an order. You have a number of machines that each have a fixed number of days to produce an item. Given that all the machines operate simultaneously, determine the minimum number of days…
Consider the following version of Bubble Sort: Given an array of integers, sort the array in ascending order using the Bubble Sort algorithm above. Once sorted, print the following three lines: Array is sorted in…
HackerLand National Bank has a simple policy for warning clients about possible fraudulent account activity. If the amount spent by a client on a particular day is greater than or equal to the client's median spending…
Shil is your new boss and he likes palindromes very much. Palindrome is a string that can be read the same way in either direction, from the left to the right and from the right to the left. (ex. madam , aabaa, racecar)…
Little Arihant has always wanted to be the best Pokemon trainer in this world. And he thinks he has achieved his goal, so he wants to quickly go and meet Professor Oak and verify this fact. But like all Pokemon…
You have reached the final level of Hunger Games and as usual a tough task awaits you. You have a circular dining table and N hungery animals.You need to place them on the table.Each animal has a hunger value. You can…
Given a List of N number a1,a2,a3........an, You have to find the smallest number from the List that is repeated in the List exactly K number of times. Input Format First Line of Input Contain Single Value N, Size of…
You have N rectangles. A rectangle is golden if the ratio of its sides is in between [1.6,1.7], both inclusive. Your task is to find the number of golden rectangles. Input format First line: Integer N denoting the…
Given A Series Of N Positive Integers a1,a2,a3........an. , Find The Minimum And Maximum Values That Can Be Calculated By Summing Exactly N-1 Of The N Integers. Then Print The Respective Minimum And Maximum Values As A…
You are given an array of integers A, you need to find the maximum sum that can be obtained by picking some non-empty subset of the array. If there are many such non-empty subsets, choose the one with the maximum number…
Quibdó in Colombia is one among the cities that receive maximum rainfall in the world. All year round, the city is covered in clouds. The city has many towns, located on a one-dimensional line. The positions and…
Starting with a 1-indexed array of zeros and a list of operations, for each operation add a value to each of the array element between two given indices, inclusive. Once all operations have been performed, return the…
Christy is interning at HackerRank. One day she has to distribute some chocolates to her colleagues. She is biased towards her friends and plans to give them more than the others. One of the program managers hears of…
You are working at the cash counter at a fun-fair, and you have different types of coins available to you in infinite quantities. The value of each coin is already given. Can you determine the number of ways of making…
Alice is a kindergarten teacher. She wants to give some candies to the children in her class. All the children sit in a line and each of them has a rating score according to his or her performance in the class. Alice…
You are given an unordered array of unique integers incrementing from . You can swap any two elements a limited number of times. Determine the largest lexicographical value array that can be created by executing no more…