HackerRank-Python(90)
-
Prepare > Python > Sets > Set .symmetric_difference() Operation
Set .symmetric_difference() Operation | HackerRank Making symmetric difference of sets. www.hackerrank.com 문제 Task Students of District College have subscriptions to English and French newspapers. Some students have subscribed to English only, some have subscribed to French only, and some have subscribed to both newspapers. You are given two sets of student roll numbers. One set has subscribed t..
2023.07.24 -
Prepare > Python > Sets > Set .difference() Operation
Set .difference() Operation | HackerRank Use the .difference() operator to check the differences between sets. www.hackerrank.com 문제 Task Students of District College have a subscription to English and French newspapers. Some students have subscribed to only the English newspaper, some have subscribed to only the French newspaper, and some have subscribed to both newspapers. You are given two se..
2023.07.24 -
Prepare > Python > Sets > Set .intersection() Operation
Set .intersection() Operation | HackerRank Use the .intersection() operator to determine the number of same students in both sets. www.hackerrank.com 문제 Task The students of District College have subscriptions to English and French newspapers. Some students have subscribed only to English, some have subscribed only to French, and some have subscribed to both newspapers. You are given two sets of..
2023.07.24 -
Prepare > Python > Sets > Set .union() Operation
Set .union() Operation | HackerRank Use the .union() operator to determine the number of students. www.hackerrank.com 문제 Input Format The first line contains an integer, n, the number of students who have subscribed to the English newspaper. The second line contains n space separated roll numbers of those students. The third line contains b, the number of students who have subscribed to the Fren..
2023.07.23 -
Prepare > Python > Sets > Set .discard(), .remove() & .pop()
Set .discard(), .remove() & .pop() | HackerRank Different ways to omit set elements. www.hackerrank.com 문제 You have a non-empty set s, and you have to execute N commands given in N lines. The commands will be pop, remove and discard. => 대충 input해주는 거 보고 그대로 실행하란 얘기 코드 n = int(input()) s = set(map(int, input().split())) N = int(input()) for i in range(N): a = input().split(' ') if a[0] == 'pop': ..
2023.07.21 -
Prepare > Python > Sets > Set .add()
Set .add() | HackerRank Add elements to set. www.hackerrank.com 문제 Task Apply your knowledge of the .add() operation to help your friend Rupal. Rupal has a huge collection of country stamps. She decided to count the total number of distinct country stamps in her collection. She asked for your help. You pick the stamps one by one from a stack of N country stamps. Find the total number of distinct..
2023.07.21 -
Prepare > Python > Sets > Symmetric Difference
Symmetric Difference | HackerRank Learn about sets as a data type. www.hackerrank.com 문제 Given 2 sets of integers, M and N, print their symmetric difference in ascending order. The term symmetric difference indicates those values that exist in either M or N but do not exist in both. => M과 N을 줄건데, 그 길이만큼의 정수 집합이 주어질 것. 각 집합의 공통되지 않은 부분들을 줄바꿔 출력하라. 코드 a = input() b = set(map(int, input().split()))..
2023.07.19