본문 바로가기

1 Day 1 Algorithms65

[2019.02.28] Utopian Tree Problem The Utopian Tree goes through 2 cycles of growth every year. Each spring, it doubles in height. Each summer, its height increases by 1 meter.Laura plants a Utopian Tree sapling with a height of 1 meter at the onset of spring. How tall will her tree be after growth cycles?For example, if the number of growth cycles is , the calculations are as follows:Period Height 0 1 1 2 2 3 3 6 4 7 5 1.. 2019. 2. 28.
[2019.02.27] Designer PDF Viewer Problem When you select a contiguous block of text in a PDF viewer, the selection is highlighted with a blue rectangle. In this PDF viewer, each word is highlighted independently. For example:In this challenge, you will be given a list of letter heights in the alphabet and a string. Using the letter heights given, determine the area of the rectangle highlight in assuming all letters are wide.For.. 2019. 2. 27.
[2019.02.26] The Hurdle Race Problem Dan is playing a video game in which his character competes in a hurdle race. Hurdles are of varying heights, and Dan has a maximum height he can jump. There is a magic potion he can take that will increase his maximum height by unit for each dose. How many doses of the potion must he take to be able to jump all of the hurdles.Given an array of hurdle heights , and an initial maximum hei.. 2019. 2. 26.
[2019.02.25] Climbing the Leaderboard Problem Alice is playing an arcade game and wants to climb to the top of the leaderboard and wants to track her ranking. The game uses Dense Ranking, so its leaderboard works like this:The player with the highest score is ranked number on the leaderboard.Players who have equal scores receive the same ranking number, and the next player(s) receive the immediately following ranking number.For exam.. 2019. 2. 25.
[2019.02.22] Picking Numbers Problem Given an array of integers, find and print the maximum number of integers you can select from the array such that the absolute difference between any two of the chosen integers is less than or equal to . For example, if your array is , you can create two subarrays meeting the criterion: and . The maximum length subarray has elements.Function DescriptionComplete the pickingNumbers functio.. 2019. 2. 22.
[2019.02.20] Forming a Magic Square Problem We define a magic square to be an matrix of distinct positive integers from to where the sum of any row, column, or diagonal of length is always equal to the same number: the magic constant.You will be given a matrix of integers in the inclusive range . We can convert any digit to any other digit in the range at cost of . Given , convert it into a magic square at minimal cost. Print this.. 2019. 2. 20.
[2019.02.19] Cats and a Mouse Problem Two cats and a mouse are at various positions on a line. You will be given their starting positions. Your task is to determine which cat will reach the mouse first, assuming the mouse doesn't move and the cats travel at equal speed. If the cats arrive at the same time, the mouse will be allowed to move and it will escape while they fight.You are given queries in the form of , , and repre.. 2019. 2. 19.
[2019.02.18] Electronics Shop Problem Monica wants to buy a keyboard and a USB drive from her favorite electronics store. The store has several models of each. Monica wants to spend as much as possible for the items, given her budget.Given the price lists for the store's keyboards and USB drives, and Monica's budget, find and print the amount of money Monica will spend. If she doesn't have enough money to both a keyboard and.. 2019. 2. 18.
[2019.02.15] Drawing Book Problem Brie’s Drawing teacher asks her class to open their books to a page number. Brie can either start turning pages from the front of the book or from the back of the book. She always turns pages one at a time. When she opens the book, page is always on the right side:When she flips page , she sees pages and . Each page except the last page will always be printed on both sides. The last page.. 2019. 2. 15.