목록문제풀이 (30)
규도자 개발 블로그
Sam's house has an apple tree and an orange tree that yield an abundance of fruit. In the diagram below, the red region denotes his house, where is the start point, and is the endpoint. The apple tree is to the left of his house, and the orange tree is to its right. You can assume the trees are located on a single point, where the apple tree is at point , and the orange tree is at point .When a ..
You are in charge of the cake for your niece's birthday and have decided the cake will have one candle for each year of her total age. When she blows out the candles, she’ll only be able to blow out the tallest ones. Your task is to find out how many candles she can successfully blow out.For example, if your niece is turning years old, and the cake will have candles of height , , , , she will be..
Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective minimum and maximum values as a single line of two space-separated long integers.For example, . Our minimum sum is and our maximum sum is . We would print16 24 Function DescriptionComplete the miniMaxSum function in the editor below. It ..
Consider a staircase of size : # ## ### #### Observe that its base and height are both equal to , and the image is drawn using # symbols and spaces. The last line is not preceded by any spaces.Write a program that prints a staircase of size .Function DescriptionComplete the staircase function in the editor below. It should print a staircase as described above.staircase has the following paramete..
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, two nega..
Given a square matrix, calculate the absolute difference between the sums of its diagonals.For example, the square matrix is shown below:1 2 3 4 5 6 9 8 9 The left-to-right diagonal = . The right to left diagonal = . Their absolute difference is .Function descriptionComplete the function in the editor below. It must return an integer representing the absolute diagonal difference.diagonalDifferen..
Calculate 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 contains s..
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 with .If , ..
[프로그래머스_연습문제_파이썬] 별찍기 문제 이 문제에는 표준 입력으로 두 개의 정수 n과 m이 주어집니다. 별(*)문자를 이용해 가로의 길이가 n, 세로의 길이가 m인 직사각형 형태를 출력해보세요. 제한사항 n과 m은 각각 1000 이하인 자연수입니다. 입출력 예 입력출력 5 3***** ***** ***** 풀이 a, b = map(int, input().strip().split(' ')) for i in range(b): print('*' * a) 설명 파이썬에서 쓸 수 있는 문자열 곱해서 프린트하기('*' * a)를 이용하여 간단하게 구현하였다.
[프로그래머스_연습문제_파이썬] 배열 검증하기 문제 길이가 n일 배열에 1부터 n까지 숫자가 중복 없이 한 번씩 들어있는지를 확인하려고 합니다. 1부터 n까지 숫자가 중복 없이 한 번씩 들어 있는 경우 true를, 아닌 경우 false를 반환하도록 함수 solution을 완성해주세요. 제한사항 배열의 길이는 10만 이하입니다. 배열의 원소는 10만 이하의 자연수입니다. 입출력 예 arrresult [4, 1, 3, 2]true[4, 1, 3]false 입출력 예 설명 입출력 예 #1 입력이 [4, 1, 3, 2]가 주어진 경우, 배열의 길이가 4이므로 배열에는 1부터 4까지 숫자가 모두 들어 있어야 합니다. [4, 1, 3, 2]에는 1부터 4까지의 숫자가 모두 들어 있으므로 true를 반환하면 됩니다...