Problem Solving
-
92. Number of 1 BitsProblem Solving 2023. 1. 19. 04:39
https://leetcode.com/problems/number-of-1-bits/description/ Number of 1 Bits - LeetCode Number of 1 Bits - Write a function that takes an unsigned integer and returns the number of '1' bits it has (also known as the Hamming weight [http://en.wikipedia.org/wiki/Hamming_weight]). Note: * Note that in some languages, such as Java, there is no un leetcode.com 2진수로 변환한 후 자릿수 1이 몇 개인지 세는 문제 class Solu..
-
91. Two Sum II - Input Array Is SortedProblem Solving 2023. 1. 19. 04:31
https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/description/ Two Sum II - Input Array Is Sorted - LeetCode Two Sum II - Input Array Is Sorted - Given a 1-indexed array of integers numbers that is already sorted in non-decreasing order, find two numbers such that they add up to a specific target number. Let these two numbers be numbers[index1] and numbers[index2 leetcode.com 더해서 ta..
-
90. Valid ParenthesesProblem Solving 2023. 1. 19. 03:50
https://leetcode.com/problems/valid-parentheses Valid Parentheses - LeetCode Valid Parentheses - Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: 1. Open brackets must be closed by the same type of brackets. 2. Open brackets must be leetcode.com 괄호 여닫기 문제 class Solution: def isValid(self, s: str)..
-
89. Unique Morse Code WordsProblem Solving 2023. 1. 19. 00:33
https://leetcode.com/problems/unique-morse-code-words/description/ Unique Morse Code Words - LeetCode Unique Morse Code Words - International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: * 'a' maps to ".-", * 'b' maps to "-...", * 'c' maps to "-.-.", and so on. For convenience, the full tabl leetcode.com 리스트로 입력받은 단어들을 모스부호로 변환한 후..
-
88. 욱제는 효도쟁이야!!Problem Solving 2023. 1. 19. 00:21
https://www.acmicpc.net/problem/14487 14487번: 욱제는 효도쟁이야!! 욱제는 KOI를 망친 기념으로 부모님과 함께 코드게이트 섬으로 여행을 떠났다. 코드게이트 섬에는 오징어로 유명한 준오마을(심술쟁이 해커 임준오 아님), 밥으로 유명한 재훈마을, 영중마을 등 www.acmicpc.net 입력받은 수의 합에서 최댓값을 빼는 문제 towns = int(input()) val = list(map(int, input().split())) print(sum(val) - max(val)) 사실 towns 변수는 사용하지 않는다
-
87. 등장하지 않는 문자의 합Problem Solving 2023. 1. 18. 11:52
https://www.acmicpc.net/problem/3059 3059번: 등장하지 않는 문자의 합 입력은 T개의 테스트 데이터로 구성된다. 입력의 첫 번째 줄에는 입력 데이터의 수를 나타내는 정수 T가 주어진다. 각 테스트 데이터는 한 줄로 구성되어 있고, 문자열 S가 주어진다. S는 알파벳 www.acmicpc.net string에 포함되지 않는 알파벳의 아스키코드 값의 합을 구하는 문제 N = int(input()) for i in range(N): lis = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'] answer = 0 str = input() fo..
-
86. 쉽게 푸는 문제Problem Solving 2023. 1. 18. 01:25
https://www.acmicpc.net/problem/1292 1292번: 쉽게 푸는 문제 첫째 줄에 구간의 시작과 끝을 나타내는 정수 A, B(1 ≤ A ≤ B ≤ 1,000)가 주어진다. 즉, 수열에서 A번째 숫자부터 B번째 숫자까지 합을 구하면 된다. www.acmicpc.net 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, .... 로 이어지는 수열에서 a번째 수부터 b번째 수까지의 합을 구하는 문제 a, b = map(int, input().split()) numbers = [] answer = 0 for i in range(1, 50): numbers = numbers + [i] * i for i in range(a, b + 1): answer = answer + numbers..
-
85. Min StackProblem Solving 2023. 1. 17. 23:51
https://leetcode.com/problems/min-stack/ Min Stack - LeetCode Min Stack - Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. Implement the MinStack class: * MinStack() initializes the stack object. * void push(int val) pushes the element val onto the stack. * void pop() leetcode.com 71. Implement Queue using Stacks와 비슷한 문제지만 queue가 아닌 stack을 구현하는 문제..