Chief Hopper
Chief's bot is playing an old DOS based game. There is a row of buildings of different heights arranged at each index along a number line. The bot starts at building and at a height of . You must determine the minimum energy his bot needs at the start so that he can jump to the top of each building without his energy going below zero. Units of height relate directly to units of energy. The bot's energy level is calculated as follows: If the bot's is less than the height of the building,
View Solution →Sherlock and MiniMax
Watson gives Sherlock an array of integers. Given the endpoints of an integer range, for all in that inclusive range, determine the minimum( abs(arr[i]-M) for all ) ). Once that has been determined for all integers in the range, return the which generated the maximum of those values. If there are multiple 's that result in that value, return the lowest one. For example, your array and your range is from to inclusive. Function Description Complete the sherlockAndMinimax function i
View Solution →Accessory Collection
Victoria is splurging on expensive accessories at her favorite stores. Each store stocks types of accessories, where the accessory costs dollars (). Assume that an item's type identifier is the same as its cost, and the store has an unlimited supply of each accessory. Victoria wants to purchase a total of accessories according to the following rule: For example, if , , and , then she must choose accessories such that any subset of of the accessories will contain at least distinct t
View Solution →Team Formation
For an upcoming programming contest, Roy is forming some teams from the students of his university. A team can have any number of contestants. Roy knows the skill level of each contestant. To make the teams work as a unit, he forms the teams based on some rules. Each of the team members must have a unique skill level for the team. If a member's skill level is where , there exists another team member whose skill level is . Note that a contestant can write buggy code and thus can have a negati
View Solution →Fighting Pits
Meereen is famous for its fighting pits where fighters fight each other to the death. Initially, there are fighters and each fighter has a strength value. The fighters are divided into teams, and each fighter belongs exactly one team. For each fight, the Great Masters of Meereen choose two teams, and , that must fight each other to the death. The teams attack each other in alternating turns, with team always launching the first attack. The fight ends when all the fighters on one of the t
View Solution →