Cerinta completa Given a rooted tree of nodes, where each node is uniquely numbered in between [1..N]. The node 1 is the root of the tree. Each node has an integer value which is initially 0. You need to perform
Minimum Average Waiting Time
Cerinta completa Tieu owns a pizza restaurant and he manages it in his own way. While in a normal restaurant, a customer is served by following the first-come, first-served rule, Tieu simply minimizes the average waiting time of his customers.
No Prefix Set
Cerinta completa There is a given list of strings where each string contains only lowercase letters from , inclusive. The set of strings is said to be a GOOD SET if no string is a prefix of another string. In
Maximum Element
Cerinta completa You have an empty sequence, and you will be given queries. Each query is one of these three types: 1 x -Push the element x into the stack. 2 -Delete the element present at the top of the
Sparse Arrays
Cerinta completa There is a collection of input strings and a collection of query strings. For each query string, determine how many times it occurs in the list of input strings. Return an array of the results. Example There are
Merging Communities
Cerinta completa People connect with each other in a social network. A connection between Person and Person is represented as . When two persons belonging to different communities connect, the net effect is the merge the communities which and belong
Lazy White Falcon
Cerinta completa White Falcon just solved the data structure problem below using heavy-light decomposition. Can you help her find a new solution that doesn’t require implementing any fancy techniques? There are types of query operations that can be performed on
Roy and alpha-beta trees
Cerinta completa Roy has taken a liking to the Binary Search Trees(BST). He is interested in knowing the number of ways an array of integers can be arranged to form a BST. Thus, he tries a few combinations, and notes
Max Transform
Cerinta completa Transforming data into some other data is typical of a programming job. This problem is about a particular kind of transformation which we’ll call the max transform. Let be a zero-indexed array of integers. For , let denote
Recalling Early Days GP with Trees
Cerinta completa Chinese Version Russian Version You are given a tree with N nodes and each has a value associated with it. You are given Q queries, each of which is either an update or a retrieval operation. The update
