HackerRank-Python(90)
-
Prepare > Python > Basic Data Types > Find the Runner-Up Score!
Find the Runner-Up Score! | HackerRank For a given list of numbers, find the second largest number. www.hackerrank.com 문제 Given the participants' score sheet for your University Sports Day, you are required to find the runner-up score. You are given n scores. Store them in a list and find the score of the runner-up. => n개의 점수를 리스트에 저장하고 2등 점수를 찾아라 코드 if __name__ == '__main__': n = int(input()) a..
2024.03.21 -
itertools > Maximize It!
Maximize It! | HackerRank Find the maximum possible value out of the equation provided. www.hackerrank.com 문제 => 각 N개의 원소를 가지는 리스트 K개가 있다. 각 리스트에서 하나의 원소를 제곱하고 서로 더한 뒤 M으로 나눈 나머지를 S라고 하자. 얻을 수 있는 S의 최댓값을 구하라. 코드 from itertools import product from itertools import accumulate K, M = map(int, input().split()) li = [] for i in range(K): li.append(list(input().split()[1:])) all_combi = list(product(*..
2024.02.12 -
Prepare > Regex > Repetitions > Matching Ending Items
Matching Ending Items | HackerRank Match the end of the string using the $ boundary matcher. www.hackerrank.com 문제 Task Write a RegEx to match a test string, S, under the following conditions: S should consist of only lowercase and uppercase letters (no numbers or symbols). S should end in s. => S는 대소문자로만 이뤄져있고, s로 끝난다 코드 Regex_Pattern = r'^[a-zA-Z]*s$'# Do not delete 'r'. import re print(str(bo..
2023.11.08 -
Prepare > Regex > Repetitions > Matching One Or More Repetitions
Matching One Or More Repetitions | HackerRank Match zero or more repetitions of character/character class/group with the + symbol. www.hackerrank.com 문제 Task You have a test string S. Your task is to write a regex that will match S using the following conditions: S should begin with 1 or more digits. After that, S should have 1 or more uppercase letters. S should end with 1 or more lowercase let..
2023.11.07 -
Prepare > Regex > Repetitions > Matching Zero Or More Repetitions
Matching Zero Or More Repetitions | HackerRank Match zero or more repetitions of character/character class/group using the * symbol in regex. www.hackerrank.com 문제 Task You have a test string S. Your task is to write a regex that will match S using the following conditions: should begin with 2 or more digits. After that, S should have 0 or more lowercase letters. S should end with 0 or more uppe..
2023.11.06 -
Prepare > Regex > Repetitions > Matching Zero Or More Repetitions
Matching Zero Or More Repetitions | HackerRank Match zero or more repetitions of character/character class/group using the * symbol in regex. www.hackerrank.com 문제 Task You have a test string S. Your task is to write a regex that will match S using the following conditions: S should begin with 1 or 2 digits. After that, S should have 3 or more letters (both lowercase and uppercase). Then S shoul..
2023.10.30 -
Prepare > Regex > Repetitions > Matching {x} Repetitions
Matching {x} Repetitions | HackerRank Match exactly x repetitions using the tool {x}. www.hackerrank.com 문제 Task You have a test string S. Your task is to write a regex that will match using the following conditions: S must be of length equal to 45. The first 40 characters should consist of letters(both lowercase and uppercase), or of even digits. The last 5 characters should consist of odd digi..
2023.10.28