Algorithm ๐ง๐ป๐ป/Leetcode31 [Leetcode,c++] Permutations II ๋ฌธ์ Permutations II - 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 permuteUnique(vector& nums) { vectorans; sort(nums.begin(),nums.end()); do{ ans.push_back(nums); }while(next_permutation(nums.begin(),nums.end())); return ans; } }; 2021. 11. 15. [Leetcode,c++] Roman to Integer ๋ฌธ์ Roman to Integer - 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: int sum=0; int roman_to_int(char c1,char c2){ bool flag = true; if(c1=='I'){ if(c2=='V'){ sum+=4; flag = false; } else if(c2 =='X'){ sum+=9; flag = false; } else sum+=1; } else if(c1==.. 2021. 11. 15. [Leetcode,c++] Find First and Last Position of Element in Sorted Array ๋ฌธ์ Find First and Last Position of Element in 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 ์ฝ๋ class Solution { public: vector searchRange(vector& nums, int target) { int start = 0; int end = nums.size()-1; int first_index = -1,last_index = -1; vectorans; while(sta.. 2021. 11. 14. [Leetcode,c++] Group Anagrams ๋ฌธ์ Group Anagrams - 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 groupAnagrams(vector& strs) { mapm; mapchar_check; sort(strs.begin(),strs.end()); vectortemp = strs; for(int i=0; i 2021. 11. 14. [Leetcode,c++] Next Permutation ๋ฌธ์ Next Permutation - 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: void nextPermutation(vector& nums) { next_permutation(nums.begin(),nums.end()); } }; 2021. 11. 14. [Leetcode,c++] Length of Last Word ๋ฌธ์ Length of Last Word - 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: int lengthOfLastWord(string s) { vectorparsing; string temp; for(int i=0; i 2021. 11. 14. [Leetcode,c++] Container With Most Water ๋ฌธ์ Container With Most Water - 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: int maxArea(vector& height) { int start = 0; int end = height.size()-1; int ans = -1; while(start 2021. 11. 14. [Leetcode,c++] Remove Duplicates from Sorted Array ๋ฌธ์ Remove Duplicates from 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 ์ฝ๋ class Solution { public: int removeDuplicates(vector& nums) { nums.erase(unique(nums.begin(),nums.end()),nums.end()); return nums.size(); } }; 2021. 11. 14. [Leetcode,c++] Longest Common Prefix ๋ฌธ์ Longest Common Prefix - 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: string longestCommonPrefix(vector& strs) { string ans=""; for(int i=0; i 2021. 11. 11. ์ด์ 1 2 3 4 ๋ค์