Coloring Tree

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

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