본문 바로가기

코딩테스트29

LeetCode - Two Sum / c++ https://leetcode.com/problems/two-sum Two Sum - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com class Solution { public: vector twoSum(vector& nums, int target) { vector result; for(int i = 0 ;i 2020. 7. 24.
해커랭크(HackerRank) - Closest Numbers / C++ 문제 : 해커랭크 Closet Number https://www.hackerrank.com/challenges/closest-numbers/problem Closest Numbers | HackerRank Find the closest numbers in a list. www.hackerrank.com 언어 : C++ // Complete the closestNumbers function below. vector closestNumbers(vector arr) { set sorted; map diffmap; for(int i = 0 ;isecond; } 2020. 7. 11.
해커랭크(HackerRank) - The Full Counting Sort / C++ 문제: 해커랭크 - The Full Counting Sort 언어 : C++ 난이도: Midium https://www.hackerrank.com/challenges/countingsort4/problem?h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen The Full Counting Sort | HackerRank The real counting sort. www.hackerrank.com // Complete the countSort function below. void countSort(vector arr) { map strmap; int half = arr.size()/2; for(int i = 0 ; i< arr.size() ;i++) { strm.. 2020. 7. 11.
해커랭크(HackerRank) - Counting Sort 1,2 / C++ 문제: 해커랭크 - Counting Sort 1,2 www.hackerrank.com/challenges/countingsort1/problem Counting Sort 1 | HackerRank Count the number of times each value appears. www.hackerrank.com 언어 : C++ Counter Sort 1 // Complete the countingSort function below. vector countingSort(vector arr) { vector counter(100); for(int i = 0 ;i 2020. 7. 11.
해커랭크(HackerRank) - Running Time of Algorithms / C++ 문제 : 해커랭크 Running Time of Algorithms www.hackerrank.com/challenges/runningtime/problem?h_r=next-challenge&h_v=zen Running Time of Algorithms | HackerRank The running time of Algorithms in general and Insertion Sort in particular. www.hackerrank.com 난이도 : easy // Complete the runningTime function below. int runningTime(vector arr) { int shfitCout = 0; for(int i = 1 ; i= 0 && arr[j]>value) { arr[j.. 2020. 7. 11.
해커랭크(HackerRank) - Strong Password / C++ 문제 : 해커랭크 - Strong Password 난이도 : easy 언어 : C++ https://www.hackerrank.com/challenges/strong-password/problem Strong Password | HackerRank How many characters should you add to make the password strong? www.hackerrank.com // Complete the minimumNumber function below. int minimumNumber(int n, string password) { // Return the minimum number of characters to make the password strong string numbers .. 2020. 6. 30.
해커랭크(HackerRank) - CamelCase / C++ 문제 : CamelCase 해커랭크 https://www.hackerrank.com/challenges/camelcase/problem CamelCase | HackerRank www.hackerrank.com 언어 : C++ 난이도: easy // Complete the camelcase function below. int camelcase(string s) { int wordCount = 1; for (int i = 0; i = 'A' && s.at(i) 2020. 6. 30.
해커랭크(HackerRank) - Drawing Book / C++ 문제 : 해커랭크 Drawing Book https://www.hackerrank.com/challenges/drawing-book/problem 언어 : C++ 난이도: Easy /* * Complete the pageCount function below. */ int pageCount(int n, int p) { /* * Write your code here. */ int f = 0; int f2 = 0; int b = 0; for (int i = 0; i f2) return f2; return f; } 2020. 6. 30.
해커랭크(HackerRank) - Climbing the Leaderboard / C++ 문제 : 해커랭크 - Climbing the Leaderboard 난이도: midium 언어 : C++ https://www.hackerrank.com/challenges/climbing-the-leaderboard/problem Climbing the Leaderboard | HackerRank Help Alice track her progress toward the top of the leaderboard! www.hackerrank.com // Complete the climbingLeaderboard function below. vector climbingLeaderboard(vector scores, vector alice) { vector aliceRank ; set scoreSet; for(.. 2020. 6. 29.