본문 바로가기

분류 전체보기1523

백준 1157 단어 공부 https://www.acmicpc.net/problem/1157 1157번: 단어 공부 알파벳 대소문자로 된 단어가 주어지면, 이 단어에서 가장 많이 사용된 알파벳이 무엇인지 알아내는 프로그램을 작성하시오. 단, 대문자와 소문자를 구분하지 않는다. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 from collections import Counter s = input().lower() counter = Counter(s) #print(counter.most_common(2)) if len(s) == 1: print(s.upper()) else: most1, most2 = counter.most_common(2) if most1[1] == most2[1]: print(.. 2023. 6. 24.
leetcode 242. Valid Anagram https://leetcode.com/problems/valid-anagram/description/?envType=study-plan-v2&envId=top-interview-150 Valid Anagram - LeetCode Can you solve this real interview question? Valid Anagram - Given two strings s and t, return true if t is an anagram of s, and false otherwise. An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using leetcode.com .. 2023. 6. 23.
leetcode 392. Is Subsequence https://leetcode.com/problems/is-subsequence/description/?envType=study-plan-v2&envId=top-interview-150 Is Subsequence - LeetCode Can you solve this real interview question? Is Subsequence - Given two strings s and t, return true if s is a subsequence of t, or false otherwise. A subsequence of a string is a new string that is formed from the original string by deleting some (can be n leetcode.co.. 2023. 6. 19.
leetcode 13. Roman to Integer https://leetcode.com/problems/roman-to-integer/description/?envType=study-plan-v2&envId=top-interview-150 Roman to Integer - LeetCode Can you solve this real interview question? Roman to Integer - Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 For example, 2 is written as II in Roman numeral, just tw leetcode.c.. 2023. 6. 19.
leetcode 27. Remove Element https://leetcode.com/problems/remove-element/description/?envType=study-plan-v2&envId=top-interview-150 Remove Element - LeetCode Can you solve this real interview question? Remove Element - Given an integer array nums and an integer val, remove all occurrences of val in nums in-place [https://en.wikipedia.org/wiki/In-place_algorithm]. The order of the elements may be changed. Then r leetcode.co.. 2023. 6. 19.
leetcode 1731. The Number of Employees Which Report to Each Employee https://leetcode.com/problems/the-number-of-employees-which-report-to-each-employee/description/?envType=study-plan-v2&envId=top-sql-50 The Number of Employees Which Report to Each Employee - LeetCode Can you solve this real interview question? The Number of Employees Which Report to Each Employee - Table: Employees +-------------+----------+ | Column Name | Type | +-------------+----------+ | e.. 2023. 6. 16.
leetcode 1211. Queries Quality and Percentage https://leetcode.com/problems/queries-quality-and-percentage/description/?envType=study-plan-v2&envId=top-sql-50 Queries Quality and Percentage - LeetCode Can you solve this real interview question? Queries Quality and Percentage - Table: Queries +-------------+---------+ | Column Name | Type | +-------------+---------+ | query_name | varchar | | result | varchar | | position | int | | rating | .. 2023. 6. 13.
leetcode 619. Biggest Single Number https://leetcode.com/problems/biggest-single-number/description/?envType=study-plan-v2&envId=top-sql-50 Biggest Single Number - LeetCode Can you solve this real interview question? Biggest Single Number - Table: MyNumbers +-------------+------+ | Column Name | Type | +-------------+------+ | num | int | +-------------+------+ There is no primary key for this table. It may contain duplicates leet.. 2023. 6. 9.
leetcode 744. Find Smallest Letter Greater Than Target https://leetcode.com/problems/find-smallest-letter-greater-than-target/description/ Find Smallest Letter Greater Than Target - LeetCode Can you solve this real interview question? Find Smallest Letter Greater Than Target - You are given an array of characters letters that is sorted in non-decreasing order, and a character target. There are at least two different characters in letters. Retu leetc.. 2023. 6. 9.
백준 28074 모비스 https://www.acmicpc.net/problem/28074 28074번: 모비스 주어진 문자열에 포함된 알파벳 대문자들을 이용해 MOBIS를 만들 수 있으면 "YES", 그렇지 않으면 "NO"를 출력한다. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 def solution(s): answer = False if 'M' in s and 'O' in s and 'B' in s and 'I' in s and 'S' in s: answer = True if answer: return 'YES' else: return 'NO' if __name__ == '__main__': s = input() print(solution(s)) Colored by Color S.. 2023. 6. 8.
백준 28097 모범생 포닉스 https://www.acmicpc.net/problem/28097 28097번: 모범생 포닉스 모두가 알다시피, 포닉스는 포스텍을 대표하는 모범생이다! 포닉스는 최고의 모범생답게 남들과는 다른 공부 계획표를 가지고 있다. 포닉스는 총 $N$개의 공부 계획을 가지고 있다. $i$번째 공부 www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 def solution(n, t): total = sum(t) + (n - 1) * 8 day, hour = total // 24, total % 24 return day, hour if __name__ == '__main__': n = int(input()) t = map(int, input().split()) print(*solution(n, t.. 2023. 6. 8.
백준 27890 특별한 작은 분수 https://www.acmicpc.net/problem/27890 27890번: 특별한 작은 분수 첫 번째 줄에 $0$초에서의 분수의 높이 $x_0$와 $N$이 주어진다. $x_0$와 $N$은 모두 정수이다. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 def solution(x, n): for i in range(n): if x % 2 == 0: x = int(x / 2) ^ 6 else: x = (2 * x) ^ 6 return x if __name__ == '__main__': x, n = map(int, input().split()) print(solution(x, n)) Colored by Color Scripter cs 2023. 6. 8.