This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <string> | |
| #include <vector> | |
| #include <algorithm> | |
| using namespace std; | |
| vector<int> solution(vector<int> arr, int divisor) { | |
| vector<int> answer; | |
| sort(arr.begin(), arr.end()); | |
| for(int i = 0; i < arr.size(); i++) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <string> | |
| #include <vector> | |
| using namespace std; | |
| string solution(string s) { | |
| string answer = ""; | |
| int len = s.length(); | |
| if(len % 2 != 0) answer += s[len / 2]; | |
| else{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <string> | |
| #include <vector> | |
| #include <algorithm> | |
| using namespace std; | |
| vector<int> solution(vector<int> answers) { | |
| vector<int> answer; | |
| int a[5] = { 1, 2, 3, 4, 5 }; | |
| int b[8] = { 2, 1, 2, 3, 2, 4, 2, 5 }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <string> | |
| #include <vector> | |
| #include <algorithm> | |
| using namespace std; | |
| bool cmp(string a, string b){ | |
| return a + b > b + a; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <string> | |
| #include <vector> | |
| #include <algorithm> | |
| using namespace std; | |
| bool cmp(string a, string b){ | |
| return a + b > b + a; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <string> | |
| #include <vector> | |
| int answer, result[20]; | |
| using namespace std; | |
| // countλ₯Ό result λ°°μ΄μ μΈλ±μ€λ‘ μ νκ³ , numbers λ°°μ΄μ μμμ κ°―μλ§νΌ | |
| // result λ°°μ΄μ 1 λλ 0μ μ±μμ 1μ +, 0μ -λ‘ numbersμ μμλ€μ | |
| // μλ§κ² κ³μ°νμ¬ νκ² λλ²μ λΉκ΅ν΄μ£Όλ ν¨μ | |
| void getResult(int count, vector<int> numbers, int target){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <string> | |
| #include <vector> | |
| using namespace std; | |
| int solution(int n) { | |
| int cur = n, cnt1 = 0, cnt2 = 0; | |
| while(cur){ | |
| int temp = cur % 2; | |
| if(temp) cnt1++; // [1] λλ¨Έμ§κ° 0μ΄ μλλΌλ©΄ cnt1μ μ¦κ° |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <string> | |
| #include <vector> | |
| using namespace std; | |
| // λ μλ₯Ό μ λ ₯λ°μ μ΅μ곡배μλ₯Ό λ°ννλ ν¨μ | |
| int solution2(int a, int b){ | |
| int x = a, y = b; | |
| while(1){ | |
| int r = a % b; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <string> | |
| #include <vector> | |
| using namespace std; | |
| int solution(int n) { | |
| int answer = 0, sum = 0, prev = 1; | |
| for(int i = 1; i <= n; i++){ | |
| // νμ¬κΉμ§ μ°μλ μμ°μμ ν©κ³Ό λ€μ μμ°μλ₯Ό λν κ°μ΄ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <string> | |
| #include <vector> | |
| #include <algorithm> | |
| using namespace std; | |
| string solution(string s) { | |
| string answer = ""; | |
| string temp = ""; // νμ¬ μ«μλ₯Ό λνλ΄λ string λ³μ |
NewerOlder