HackerRank-Python(90)
-
Prepare > Python > Itertools > itertools.combinations()
itertools.combinations() | HackerRank Print all the combinations of a string using itertools. www.hackerrank.com 문제 Task You are given a string S. Your task is to print all possible combinations, up to size k, of the string in lexicographic sorted order. Input Format A single line containing the string S and integer value k separated by a space. Output Format Print the different combinations of ..
2023.08.13 -
Prepare> Python > Itertools > itertools.permutations()
itertools.permutations() | HackerRank Find all permutations of a given size in a given string. www.hackerrank.com 문제 Task You are given a string S. Your task is to print all possible permutations of size k of the string in lexicographic sorted order. => S로 길이가 k인 순열들을 정렬해 출력하라 코드 from itertools import permutations S, k = input().split() A = sorted(list(permutations(S, int(k)))) for i in range(le..
2023.08.05 -
Prepare > Python > Itertools > itertools.product()
itertools.product() | HackerRank Find the cartesian product of 2 sets. www.hackerrank.com 문제 Task You are given a two lists A and B. Your task is to compute their cartesian product AXB. => 리스트 A와 B를 줄테니까 A와 B의 데카르트 곱을 구해라 코드 from itertools import product A = list(map(int, input().split())) B = list(map(int, input().split())) print( ' '.join(str(x) for x in list(product(A,B))) ) str(x) for x in l..
2023.07.29 -
Prepare > Python > Sets > Check Strict Superset
Check Strict Superset | HackerRank Check if A is a strict superset of the other given sets. www.hackerrank.com 문제 You are given a set A and n other sets. Your job is to find whether set A is a strict superset of each of the n sets. Print True, if A is a strict superset of each of the N sets. Otherwise, print False. A strict superset has at least one element that does not exist in its subset. Inp..
2023.07.28 -
Prepare > Python > Sets > Check Subset
Check Subset | HackerRank Verify if set A is a subset of set B. www.hackerrank.com 문제 Input Format The first line will contain the number of test cases, T. The first line of each test case contains the number of elements in set A. The second line of each test case contains the space separated elements of set A. The third line of each test case contains the number of elements in set B. The fourth..
2023.07.27 -
Prepare > Python > Sets > The Captain's Room
The Captain's Room | HackerRankOut of a list of room numbers, determine the number of the captain's room.www.hackerrank.com 문제Mr. Anant Asankhya is the manager at the INFINITE hotel. The hotel has an infinite amount of rooms. One fine day, a finite number of tourists come to stay at the hotel. The tourists consist of: → A Captain. → An unknown group of families consisting of K members per group..
2023.07.26 -
Prepare > Python > Sets > Set Mutations
Set Mutations | HackerRank Using various operations, change the content of a set and output the new sum. www.hackerrank.com 문제 TASK You are given a set A and N number of other sets. These N number of sets have to perform some specific mutation operations on set A. Your task is to execute those operations and print the sum of elements from set A. Input Format The first line contains the number of..
2023.07.25