본문 바로가기

hackerrank6

[HackerRank] Find the Runner-Up Score! (Python3) Problem: https://www.hackerrank.com/challenges/find-second-maximum-number-in-a-list/problem?isFullScreen=true Find the Runner-Up Score! | HackerRank For a given list of numbers, find the second largest number. www.hackerrank.com 안녕하세요. 오랜만입니다. 오랜만이라는 얘기를 몇 번째 하는 건지.. 방학 때라도 코딩 공부를 열심히 했었어야 하는데 ㅠ 토플이니, 수업 준비니, 대학 행정 잡무 등등.. 많이 바쁘긴했습니다 (변명 아닌 변명.. 꾸벅) 사실 오늘도 이걸 하려고 들어온 건 아니긴 한데, 학생들 코딩 문제 좀 내볼까~? .. 2023. 9. 5.
[HackerRank] Birthday Cake Candles (Python3) Birthday Cake Candles | HackerRank Determine the number of candles that are blown out. www.hackerrank.com 안녕하세요. 오랜만에 돌아왔습니다. 그 동안 물갈이에다 장염이 걸려서 참 오랫동안 누워있었고... (거의 일주일간 ㅠㅠ ) 이제야 정신을 차렸네요. 오늘은 HackerRank에 있는 문제를 가져왔구요. 푸는 건 빠르게 풀었는데 이렇게 푸는게 맞나? 싶긴 합니다.. #!/bin/python3 import math import os import random import re import sys # # Complete the 'birthdayCakeCandles' function below. # # The function .. 2023. 2. 6.
[HackerRank] Mini-Max Sum (Python3) Mini-Max Sum | HackerRank Find the maximum and minimum values obtained by summing four of five integers. www.hackerrank.com 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. 5개의 element를 가진 array를 받아서 그 중에.. 2023. 1. 26.
[HackerRank] Diagonal Difference (Python3) 2023년을 맞아 새롭게 시작하는 1 Day 1 Commit Challenge! 2022년 한 해 동안 6개 밖에 하지 않아서 조금 부끄럽다... 인도네시아에서 학생들을 가르치면서 하루에 하나씩 알고리즘을 정복해보자. 오늘은 조금 쉬운 Hackers의 prepare/algorithm에서 문제를 가져왔다. Diagonal Difference | HackerRank Calculate the absolute difference of sums across the two diagonals of a square matrix. www.hackerrank.com #!/bin/python3 import math import os import random import re import sys # # Complete the.. 2023. 1. 19.
[HackerRank] PlusMinus (python) Given an array of integers, calculate the ratios of its elements that are positive, negative, and zero. Print the decimal value of each fraction on a new line with places after the decimal. 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. Example There are elements, two positive, two n.. 2022. 4. 9.
[HackerRank] Diagonal Difference (python) #!/bin/python3 import math import os import random import re import sys # # Complete the 'diagonalDifference' function below. # # The function is expected to return an INTEGER. # The function accepts 2D_INTEGER_ARRAY arr as parameter. # def diagonalDifference(arr): # Write your code here left = 0 right = 0 for i in range(len(arr)): left += arr[i][i] right += arr[i][len(arr)-i-1] return abs(left .. 2022. 4. 7.