Cerinta completa You are given a tree with N nodes with every node being colored. A color is represented by an integer ranging from 1 to 109. Can you find the number of distinct colors available in a subtree rooted
Tower Breakers, Again!
Cerinta completa Two players (numbered and ) are playing a game of Tower Breakers! The rules of the game are as follows: Player always moves first. Initially there are towers of various heights. The players move in alternating turns. In
The Time in Words
Cerinta completa 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.
Xor-sequence
Cerinta completa An array, , is defined as follows: for , where is the symbol for XOR You will be given a left and right index . You must determine the XOR sum of the segment of as . For
Time Conversion
Cerinta completa Given a time in -hour AM/PM format, convert it to military (24-hour) time. Note: – 12:00:00AM on a 12-hour clock is 00:00:00 on a 24-hour clock. – 12:00:00PM on a 12-hour clock is 12:00:00 on a 24-hour clock.
XOR key
Cerinta completa Xorq has invented an encryption algorithm which uses bitwise XOR operations extensively. This encryption algorithm uses a sequence of non-negative integers as its key. To implement this algorithm efficiently, Xorq needs to find maximum value of for given
Balanced Forest
Cerinta completa Greg has a tree of nodes containing integer data. He wants to insert a node with some non-zero integer value somewhere into the tree. His goal is to be able to cut two edges and have the values
The Maximum Subarray
Cerinta completa We define subsequence as any subset of an array. We define a subarray as a contiguous subsequence in an array. Given an array, find the maximum possible sum among: all nonempty subarrays. all nonempty subsequences. Print the two
Array Manipulation
Cerinta completa Starting with a 1-indexed array of zeros and a list of operations, for each operation add a value to each array element between two given indices, inclusive. Once all operations have been performed, return the maximum value in
Wet Shark and Two Subsequences
Cerinta completa One day, Wet Shark was given an array . As always, he started playing with its subsequences. When you came to know about this habit, you presented him a task of finding all pairs of subsequences, , which
