본문 바로가기

python38

[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] 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.
[Programmers] 아이스아메리카노 (python3) 프로그래머스에 나온 level.0의 쉬운 문제. 쉬운 문제부터 정복해보자 하는 생각에 풀어보았다. 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 머쓱이는 추운 날에도 아이스 아메리카노만 마십니다. 아이스 아메리카노는 한잔에 5,500원입니다. 머쓱이가 가지고 있는 돈 money가 매개변수로 주어질 때, 머쓱이가 최대로 마실 수 있는 아메리카노의 잔 수와 남는 돈을 순서대로 담은 배열을 return 하도록 solution 함수를 완성해보세요. 제한사항 0 < money ≤ 1,000,000 입출력 예 moneyresult 5,500[1, 0] 15,000[.. 2023. 1. 20.
[LeetCode] 13. Romans to Integer (Python) Problem Roman to Integer - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 말그대로 로마어를 숫자로 바꾸는 프로그램이다. 문제를 이해하는 것에는 어렵지 않았고 문자어로 쓰여있는 것을 각각 숫자로 변환하여 더해주면 되는 듯한 간단한 문제라고 생각이 되었다. -> 하지만 단순히 이런 방식을 꾀하면 VI(6)와 IV(4)의 차이가 없어진다. 따라서 뒤에 큰 숫자가 오면 (큰 수 - 작은 수)의 방법을 취해야 하는 것을 알 수 있다. 어떻게 풀어야 .. 2022. 4. 9.
[LeetCode] 9. Palindrome Number (python) Palindrome Number - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Problem 오늘의 문제는 Palinedrome Number을 판별하는 코드를 작성하는 것이다. Palinedrome 숫자란 121처럼 앞뒤를 바꿔도 똑같은 (전화번호 아님) 숫자를 말한다. 이 문제에서 주의해야 할 것은 음의 정수가 포함된다는 것이다! -121을 바꿔면 121-이므로 Palinedrome 숫자가 아니다. (설명도 적어야 한다.) First Try: Wrong A.. 2022. 4. 9.
[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.