Closest Numbers

Cerinta completa Sorting is useful as the first step in many different tasks. The most common task is to make finding things easier, but there are other uses as well. In this case, it will make it easier to determine

Choosing White Balls

Cerinta completa There are balls in a row, and each ball is either black (B) or white (W). Perform removal operations with the goal of maximizing the number of white balls picked. For each operation (where ): Choose an integer,

Chocolate in Box

Cerinta completa Dexter and Debra are playing a game. They have N containers each having one or more chocolates. Containers are numbered from 1 to N, where ith container has A[i] number of chocolates. The game goes like this. First

Cipher

Cerinta completa Jack and Daniel are friends. They want to encrypt their conversations so that they can save themselves from interception by a detective agency so they invent a new cipher. Every message is encoded to its binary representation. Then

Circular Array Rotation

Cerinta completa John Watson knows of an operation called a right circular rotation on an array of integers. One rotation operation moves the last array element to the first position and shifts all remaining elements right one. To test Sherlock’s

Chief Hopper

Cerinta completa Chief’s bot is playing an old DOS based game. There is a row of buildings of different heights arranged at each index along a number line. The bot starts at building and at a height of . You

Chocolate Feast

Cerinta completa Little Bobby loves chocolate. He frequently goes to his favorite store, Penny Auntie, to buy them. They are having a promotion at Penny Auntie. If Bobby saves enough wrappers, he can turn them in for a free chocolate.

Chocolate Game

Cerinta completa Laurel and Hardy have piles of chocolates with each pile containing some number of chocolates. The piles are arranged from left to right in a non decreasing order based on the number of chocolates in each pile. They

Changing Bits

Cerinta completa Let a and b be binary numbers of length n (MSB to the left). The following commands may be performed: set_a idx x: Set to , where and is least significant bit of . set_b idx x: Set