https://leetcode.com/problems/jump-game/ Jump Game - 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 [leetcode][C++][Java] jump game 처음 보자마자 생각난건 dp.. greedy로 풀면 코드도 간결하고 java로도 1ms가 나온다. C++ // greedy class Solution { public: bool canJump(vector& nums) { int last = nums.size() - 1..
https://leetcode.com/problems/search-in-rotated-sorted-array/ Search in Rotated Sorted Array - 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 input값은 정렬된 배열이기 때문에 바이너리 서치를 사용할 수 있다. 배열이 시작하는 시점 (정렬이 끝나는 시점)을 찾아서 범위마다 바이너리 서치를 실행해서 풀었다. nums[] = {5 1 < 2 < 3 < 4} binarySe..
https://leetcode.com/problems/generate-parentheses/ Generate Parentheses - 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 [leetcode][C++] generate parentheses class Solution { public: void dfs(int l, int r, int n, string s, vector& ret) { if (l == n && r == n) { ret.push_back(s); ..
https://leetcode.com/problems/letter-combinations-of-a-phone-number/ Letter Combinations of a Phone Number - 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 [leetcode][C++][Java] letter combinations of a phone number C++ class Solution { public: string arr[10] = { "","","abc","def"..
https://programmers.co.kr/learn/courses/30/lessons/84512 코딩테스트 연습 - 5주차_모음사전 사전에 알파벳 모음 'A', 'E', 'I', 'O', 'U'만을 사용하여 만들 수 있는, 길이 5 이하의 모든 단어가 수록되어 있습니다. 사전에서 첫 번째 단어는 "A"이고, 그다음은 "AA"이며, 마지막 단어는 "UUUUU"입니 programmers.co.kr [프로그래머스][C++] 모음사전 #include #include using namespace std; char mo[5] = { 'A','E','I','O','U' }; int answer = 0; bool dfs(string word, string find) { answer++; if (!word.comp..