String Reduction

Cerinta completa Given a string consisting of the letters , and , we can perform the following operation: Take any two adjacent distinct characters and replace them with the third character. Find the shortest string obtainable through applying this operation

Tree Pruning

Cerinta completa A tree, , has vertices numbered from to and is rooted at vertex . Each vertex has an integer weight, , associated with it, and ‘s total weight is the sum of the weights of its nodes. A

Sorted Subsegments

Cerinta completa Consider an array of integers. We perform queries of the following type on : Sort all the elements in the subsegment . Given , can you find and print the value at index (where ) after performing queries?

The Blacklist

Cerinta completa A new gangster is trying to take control of the city. He makes a list of his adversaries (e.g. gangster , gangster , … gangster , gangster ) and plans to get rid of them. mercenaries are willing

Stone Piles

Cerinta completa There are piles of stones where the ith pile has stones in it. Alice and Bob play the following game: Alice starts, and they alternate turns. In a turn, a player can choose any one of the piles

Staircase

Cerinta completa Staircase detail This is a staircase of size : # ## ### #### Its base and height are both equal to . It is drawn using # symbols and spaces. The last line is not preceded by any

Tastes Like Winning

Cerinta completa Stephanie just learned about a game called Nim in which there are two players and piles of stones. During each turn, a player must choose any non-empty pile and take as many stones as they want. The first