분류 전체보기
-
[HackerRank] counting sort 1 c++Coding Test/HackerRank 2022. 7. 20. 10:29
Problem Quicksort usually has a running time of n x log(n), but is there an algorithm that can sort even faster? In general, this is not possible. Most sorting algorithms are comparison sorts, i.e. they sort a list just by comparing the elements to one another. A comparison sort algorithm cannot beat n x log(n) (worst-case) running time, since n x log(n) represents the minimum number of comparis..
-
[HackerRank] Between Two Sets c++Coding Test/HackerRank 2022. 7. 19. 23:18
Problem There will be two arrays of integers. Determine all integers that satisfy the following two conditions: The elements of the first array are all factors of the integer being considered The integer being considered is a factor of all elements of the second array These numbers are referred to as being between the two arrays. Determine how many such numbers exist. Example a = [2, 6] b = [24,..
-
[HackerRank] Number Line Jumps c++Coding Test/HackerRank 2022. 7. 19. 15:49
Problem You are choreographing a circus show with various animals. For one act, you are given two kangaroos on a number line ready to jump in the positive direction (i.e, toward positive infinity). The first kangaroo starts at location x1 and moves at a rate of v1 meters per jump. The second kangaroo starts at location x2 and moves at a rate of v2 meters per jump. You have to figure out a way to..
-
[HackerRank] Apple and Orange c++Coding Test/HackerRank 2022. 7. 19. 13:47
Problem Sam's house has an apple tree and an orange tree that yield an abundance of fruit. Using the information given below, determine the number of apples and oranges that land on Sam's house. In the diagram below: The red region denotes the house, where s is the start point, and t is the endpoint. The apple tree is to the left of the house, and the orange tree is to its right. Assume the tree..
-
[HackerRank] Grading Students c++Coding Test/HackerRank 2022. 7. 18. 19:32
Problem HackerLand University has the following grading policy: - Every student receives a grade in the inclusive range from 0 to 100 . - Any grade less than 40 is a failing grade. Sam is a professor at the university and likes to round each student's grade according to these rules: - If the difference between the and the next multiple of 5 is less than 3, round grade up to the next multiple of ..