Bike Racers
There are bikers present in a city (shaped as a grid) having bikes. All the bikers want to participate in the HackerRace competition, but unfortunately only bikers can be accommodated in the race. Jack is organizing the HackerRace and wants to start the race as soon as possible. He can instruct any biker to move towards any bike in the city. In order to minimize the time to start the race, Jack instructs the bikers in such a way that the first bikes are acquired in the minimum time. Every
View Solution →Task Scheduling
You have a long list of tasks that you need to do today. To accomplish task you need minutes, and the deadline for this task is . You need not complete a task at a stretch. You can complete a part of it, switch to another task, and then switch back. You've realized that it might not be possible to complete all the tasks by their deadline. So you decide to do them in such a manner that the maximum amount by which a task's completion time overshoots its deadline is minimized. Input Format
View Solution →Similar Pair
A pair of nodes, , is a similar pair if the following conditions are true: node is the ancestor of node Given a tree where each node is labeled from to , find the number of similar pairs in the tree. Function Description Complete the similarPair function in the editor below. It should return an integer that represents the number of pairs meeting the criteria. similarPair has the following parameter(s): n: an integer that represents the number of nodes k: an integer edges:
View Solution →Absolute Element Sums
Given an array of integers, you must answer a number of queries. Each query consists of a single integer, , and is performed as follows: Add to each element of the array, permanently modifying it for any future queries. Find the absolute value of each element in the array and print the sum of the absolute values on a new line. Tip: The Input/Output for this challenge is very large, so you'll have to be creative in your approach to pass all test cases. Function Description Complete th
View Solution →Almost Integer Rock Garden
ictor is building a Japanese rock garden in his square courtyard. He overlaid the courtyard with a Cartesian coordinate system so that any point in the courtyard has coordinates and . Victor wants to place stones in the garden according to the following rules: The center of each stone is located at some point , where and are integers . The coordinates of all twelve stones are pairwise distinct. The Euclidean distance from the center of any stone to the origin is not an integer. The s
View Solution →