알고리즘 풀이
-
Sales by Match알고리즘 풀이/HackerRank 2021. 12. 5. 08:52
https://www.hackerrank.com/challenges/sock-merchant/problem?isFullScreen=true&h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=warmup Sales by Match | HackerRank How many pairs of socks can Alex sell? www.hackerrank.com 문제 이해 및 분석 1. pair 로 이루어 질 수 있는 n개의 수가 존재한다. 2. pair는 두개씩 3. 주어진 n개의 수에서 각 숫자가 이루는 pair 의 총 합을 구한다. 문제 풀이 1. 주어진 값을 정렬한다. 2. 그리고 중복을 제거한다. 그러면 고유..
-
Jumping on the Clouds알고리즘 풀이/HackerRank 2021. 12. 5. 08:01
https://www.hackerrank.com/challenges/jumping-on-the-clouds/problem?isFullScreen=true&h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=warmup Jumping on the Clouds | HackerRank Jumping on the clouds www.hackerrank.com 문제 이해 및 분석 1. 플레이어는 0 또는 1의 구름을 지나가야 한다. 2. 1의 구름은 올라갈 수 없다. 3. 0의 구름만 올라갈 수 있다. 4. 0의 구름에서 +1또는 +2 인덱스 상위의 구름만 갈 수 있다. 5. 끝까지 못가는 경우는 없다. 문제 풀이 시작..