분류 전체보기
- 
                            [LeetCode] 26. Remove Duplicates from Sorted Array c++Coding Test/LeetCode 2022. 9. 15. 10:28문제 설명 Given an integer array nums sorted in non-decreasing order, remove the duplicates in-place such that each unique element appears only once. The relative order of the elements should be kept the same. Since it is impossible to change the length of the array in some languages, you must instead have the result be placed in the first part of the array nums. More formally, if there are k elemen.. 
- 
                            [LeetCode] 1. Two Sum c++Coding Test/LeetCode 2022. 9. 14. 17:59문제 설명 Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order. 제한 사항 2 
- 
                            [프로그래머스] 체육복 c++Coding Test/programmers 2022. 9. 13. 20:45문제 설명 점심시간에 도둑이 들어, 일부 학생이 체육복을 도난당했습니다. 다행히 여벌 체육복이 있는 학생이 이들에게 체육복을 빌려주려 합니다. 학생들의 번호는 체격 순으로 매겨져 있어, 바로 앞번호의 학생이나 바로 뒷번호의 학생에게만 체육복을 빌려줄 수 있습니다. 예를 들어, 4번 학생은 3번 학생이나 5번 학생에게만 체육복을 빌려줄 수 있습니다. 체육복이 없으면 수업을 들을 수 없기 때문에 체육복을 적절히 빌려 최대한 많은 학생이 체육수업을 들어야 합니다. 전체 학생의 수 n, 체육복을 도난당한 학생들의 번호가 담긴 배열 lost, 여벌의 체육복을 가져온 학생들의 번호가 담긴 배열 reserve가 매개변수로 주어질 때, 체육수업을 들을 수 있는 학생의 최댓값을 return 하도록 solution 함수를.. 
- 
                            [프로그래머스] 두 개 뽑아서 더하기 c++Coding Test/programmers 2022. 9. 13. 13:51문제 설명 정수 배열 numbers가 주어집니다. numbers에서 서로 다른 인덱스에 있는 두 개의 수를 뽑아 더해서 만들 수 있는 모든 수를 배열에 오름차순으로 담아 return 하도록 solution 함수를 완성해주세요. 제한 사항 numbers의 길이는 2 이상 100 이하입니다. numbers의 모든 수는 0 이상 100 이하입니다. 입출력 예 numbers result [2,1,3,4,1] [2,3,4,5,6,7] [5,0,2,7] [2,5,7,9,12] 풀이 순열을 사용한 조합 구하는 방법을 사용했습니다. nCr = numbers.size() C 2 조합을 구하기 위해서 보조 수열이 필요합니다. 1.보조 수열은 numbers사이즈 크기로 생성하고, 0으로 초기화 합니다. 2. 2개만 뽑아야 ..