hackerrank2 [HackerRank] Breaking the Records (PYTHON) 문제 링크 : https://www.hackerrank.com/challenges/breaking-best-and-worst-records/problem Breaking the Records | HackerRank Given an array of Maria's basketball scores all season, determine the number of times she breaks her best and worst records. www.hackerrank.com 최고기록을 갱신 시마다 업데이트 시켜주는 것이 중요하다는 것을 알게 되었습니다. def breakingRecords(scores): # Write your code here win_cnt, lose_cnt = 0,0 breaking_win,.. 2021. 11. 1. [HackerRank] Divisible Sum Pairs (PYTHON) 문제 링크 : https://www.hackerrank.com/challenges/divisible-sum-pairs/problem Divisible Sum Pairs | HackerRank Count the number of pairs in an array having sums that are evenly divisible by a given number. www.hackerrank.com O(n²) 의 시간복잡도를 가진다. def divisibleSumPairs(n, k, ar): # Write your code here cnt = 0 for i in range(len(ar)): for j in range(i+1,len(ar)): if (ar[i] + ar[j]) % k == 0: cnt += 1 r.. 2021. 11. 1. 이전 1 다음