본문 바로가기

1 Day 1 Algorithms65

[2018.12.17] Plus Minus Problem Given an array of integers, calculate the fractions of its elements that are positive, negative, and are zeros. Print the decimal value of each fraction on a new line.Note: This challenge introduces precision problems. The test cases are scaled to six decimal places, though answers with absolute error of up to are acceptable.For example, given the array there are elements, two positive, .. 2018. 12. 17.
[2018.12.17] Let's Review Problem Objective Today we're expanding our knowledge of Strings and combining it with what we've already learned about loops. Check out the Tutorial tab for learning materials and an instructional video!Task Given a string, , of length that is indexed from to , print its even-indexed and odd-indexed characters as space-separated strings on a single line (see the Sample below for more detail).No.. 2018. 12. 17.
[2018.12.16] Loops Problem Objective In this challenge, we're going to use loops to help us do some simple math. Check out the Tutorial tab to learn more.Task Given an integer, , print its first multiples. Each multiple (where ) should be printed on a new line in the form: n x i = result.Input FormatA single integer, .ConstraintsOutput FormatPrint lines of output; each line (where ) contains the of in the form: n .. 2018. 12. 17.
[2018.12.15] Class vs. Instance Problem Objective In this challenge, we're going to learn about the difference between a class and an instance; because this is an Object Orientedconcept, it's only enabled in certain languages. Check out the Tutorial tab for learning materials and an instructional video!Task Write a Person class with an instance variable, , and a constructor that takes an integer, , as a parameter. The construc.. 2018. 12. 17.
[2018.12.14] A Very Big Sum Problem alculate and print the sum of the elements in an array, keeping in mind that some of those integers may be quite large.Function DescriptionComplete the aVeryBigSum function in the editor below. It must return the sum of all array elements.aVeryBigSum has the following parameter(s):ar: an array of integers .Input FormatThe first line of the input consists of an integer . The next line con.. 2018. 12. 14.
[2018.12.13] Counting Valleys Problem Gary is an avid hiker. He tracks his hikes meticulously, paying close attention to small details like topography. During his last hike he took exactly steps. For every step he took, he noted if it was an uphill, , or a downhill, step. Gary's hikes start and end at sea level and each step up or down represents a unit change in altitude. We define the following terms:A mountain is a sequen.. 2018. 12. 14.
[2018.12.13] Compare the Triplets Problem Alice and Bob each created one problem for HackerRank. A reviewer rates the two challenges, awarding points on a scale from to for three categories: problem clarity, originality, and difficulty.We define the rating for Alice's challenge to be the triplet , and the rating for Bob's challenge to be the triplet .Your task is to find their comparison points by comparing with , with , and wit.. 2018. 12. 14.
[2018.12.12] Sock Merchant Problem John works at a clothing store. He has a large pile of socks that he must pair by color for sale. Given an array of integers representing the color of each sock, determine how many pairs of socks with matching colors there are.For example, there are socks with colors . There is one pair of color and one of color . There are three odd socks left, one of each color. The number of pairs is .. 2018. 12. 14.
[2018.12.12] Simple Array Sum Problem Given an array of integers, find the sum of its elements.For example, if the array , , so return .Function DescriptionComplete the simpleArraySum function in the editor below. It must return the sum of the array elements as an integer.simpleArraySum has the following parameter(s):ar: an array of integersInput FormatThe first line contains an integer, , denoting the size of the array. The.. 2018. 12. 14.