Cerinta completa Given a tree of N nodes, where each node is uniquely numbered in between [1, N]. Each node also has a value which is initially 0. You need to perform following two operations in the tree. Update Operation
Walking the Approximate Longest Path
Cerinta completa Jenna is playing a computer game involving a large map with cities numbered sequentially from to that are connected by bidirectional roads. The game’s objective is to travel to as many cities as possible without visiting any city
Castle on the Grid
Cerinta completa You are given a square grid with some cells open (.) and some blocked (X). Your playing piece can move along any row or column until it reaches the edge of the grid or a blocked cell. Given
Yet Another Minimax Problem
Cerinta completa You are given non-negative integers, . We define the score for some permutation () of length to be the maximum of for . Find the permutation with the minimum possible score and print its score. Note: is the
Direct Connections
Cerinta completa Enter-View is a linear, street-like country. By linear, we mean all the cities of the country are placed on a single straight line – the -axis. Thus every city’s position can be defined by a single coordinate, ,
Vertical Paths
Cerinta completa You have a rooted tree with vertices numbered from through where the root is vertex . You are given triplets, the triplet is denoted by three integers . The triplet represents a simple path in the tree with
Binary Search Tree : Lowest Common Ancestor
Cerinta completa You are given pointer to the root of the binary search tree and two values and . You need to return the lowest common ancestor (LCA) of and in the binary search tree. In the diagram above, the
Xor and Sum
Cerinta completa You are given two positive integers and in binary representation. You should find the following sum modulo : where operation means exclusive OR operation, operation means binary shift to the left. Please note, that we consider ideal model
Weighted Uniform Strings
Cerinta completa A weighted string is a string of lowercase English letters where each letter has a weight. Character weights are to from to as shown below: The weight of a string is the sum of the weights of its
Vertical Rooks
Cerinta completa HackerChess is a variant of chess played at HackerRank. It is a game played between two players who make moves in turns until one of them cannot make any move. The player who cannot make a move loses
