title-img


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 →

Game of Stones

Two players called and are playing a game with a starting number of stones. Player always plays first, and the two players move in alternating turns. The game's rules are as follows: In a single move, a player can remove either , , or stones from the game board. If a player is unable to make a move, that player loses the game. Given the starting number of stones, find and print the name of the winner. is named First and is named Second. Each player plays optimally, meaning they will n

View Solution →