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 Algorithms > Implementation 점수 배열이 주어지면 최저점과 최고점이 갱신되는 횟수를 각각 저장하여 배열로 리턴한다. 코드 int* breakingRecords(int scores_count, int* scores, int* resul..
https://www.hackerrank.com/challenges/runningtime/problem Running Time of Algorithms | HackerRank The running time of Algorithms in general and Insertion Sort in particular. www.hackerrank.com Algorithms > Sorting 배열이 주어지면 해당 배열을 정렬하여 shift 횟수를 리턴한다. 코드 int runningTime(int arr_count, int* arr) { int *temp = arr; int val, res = 0; for(int i = 1; i < arr_count; i++){ val = temp[i]; int j = i - 1; ..
https://www.hackerrank.com/challenges/migratory-birds/problem Migratory Birds | HackerRank Determine which type of bird in a flock occurs at the highest frequency. www.hackerrank.com Algorithms > Implementation 주어진 배열에서 가장 자주 등장하는 id값을 출력한다. 단, 같은 빈도의 id가 여러 개일 경우 더 작은 값을 출력한다. 코드 int migratoryBirds(int arr_count, int* arr) { int *check = (int *)malloc(arr_count * sizeof(int)); for (int i = 0; i..
https://www.hackerrank.com/challenges/the-power-sum/problem The Power Sum | HackerRank Split up a number in a specified manner. www.hackerrank.com Algorithms > Recursion 정수 X와 N이 주어지고, 어떤 수들의 N제곱의 합이 X와 같아지는 경우의 수를 찾는 문제다. 코드 int powerSum(int X, int N, int base, int sum) { int temp = pow(base, N); if (sum + temp == X) return 1; else if (sum > X || temp > X) return 0; else { return powerSum(X, N,..