HackerRank-Python(90)
-
Prepare > Python > Itertools > Iterables and Iterators
Iterables and Iterators | HackerRank Find the probability using itertools. www.hackerrank.com 문제 Input Format The input consists of three lines. The first line contains the integer N, denoting the length of the list. The next line consists of N space-separated lowercase English letters, denoting the elements of the list. The third and the last line of input contains the integer S, denoting the n..
2023.09.19 -
Prepare > Python > Sets > No Idea!
No Idea! | HackerRank Compute your happiness. www.hackerrank.com 문제 Input Format The first line contains integers n and m separated by a space. The second line contains n integers, the elements of the array. The third and fourth lines contain m integers, A and B, respectively. Output Format Output a single integer, your total happiness. => 정수 n개로 이뤄진 배열(N)과 정수 m개를 가진 서로소 set A, B을 줄건데, 배열(N)의 요소..
2023.09.16 -
Prepare > Python > Strings > Merge the Tools!
Merge the Tools! | HackerRank Split a string into subsegments of length $k$, then print each subsegment with any duplicate characters stripped out. www.hackerrank.com 문제 => 문자열 string과 정수 k를 줄건데 string을 k개씩 나눈 substring을 각각 중복알파벳을 제거해 출력하라 string의 길이는 k의 배수임이 보장되고, string에서의 순서대로 앞에서부터 줄바꿈으로 출력. 코드 def merge_the_tools(string, k): for i in range(len(string)//k): s = list(string)[k*i:k*i+k] unique..
2023.09.15 -
Prepare > Python > Numpy > Linear Algebra
Linear Algebra | HackerRank NumPy routines for linear algebra calculations. www.hackerrank.com 문제 Task You are given a square matrix A with dimensions N X N. Your task is to find the determinant. Note: Round the answer to 2 places after the decimal. Input Format The first line contains the integer N. The next N lines contains the N space separated elements of array A. Output Format Print the det..
2023.09.09 -
Prepare > Python > Numpy > Polynomials
Polynomials | HackerRank Given the coefficients, use polynomials in NumPy. www.hackerrank.com 문제 Task You are given the coefficients of a polynomial P. Your task is to find the value of P at point x. Input Format The first line contains the space separated value of the coefficients in P. The second line contains the value of x. Output Format Print the desired value. => 다항식 P의 계수들을 줄건데 특정 x에서의 P값..
2023.09.08 -
Prepare > Python > Numpy > Inner and Outer
Inner and Outer | HackerRank Use NumPy to find the inner and outer product of arrays. www.hackerrank.com 문제 Task You are given two arrays: A and B. Your task is to compute their inner and outer product. Input Format The first line contains the space separated elements of array A. The second line contains the space separated elements of array B. Output Format First, print the inner product. Secon..
2023.09.07 -
Prepare > Python > Numpy > Dot and Cross
Dot and Cross | HackerRank Use NumPy to find the dot and cross products of arrays. www.hackerrank.com 문제 Task You are given two arrays A and B. Both have dimensions of N X N. Your task is to compute their matrix product. Input Format The first line contains the integer N. The next N lines contains N space separated integers of array A. The following N lines contains N space separated integers of..
2023.09.06