๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

Algorithm ๐Ÿง‘๐Ÿป‍๐Ÿ’ป/Leetcode31

[Leetcode,c++] Multiply-Strings ๋ฌธ์ œ Multiply Strings - 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 multiply(string num1, string num2) { if(num1 == "0" || num2 == "0") return "0"; vector v(num1.length() + num2.length(), 0); for(int i = num1.length()-1; i >= 0; i--){ for(int k .. 2021. 11. 7.
[Leetcode,c++] Longest Common Subsequence Longest Common Subsequence - 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 longestCommonSubsequence(string text1, string text2) { int dp[1001][1001]; for(int i=1; i 2021. 10. 23.
[Leetcode,c++] Robot Bounded In Circle Robot Bounded In Circle - 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: bool isRobotBounded(string instructions) { int visited[101][101]; int x=0,y=0,dir=0; //e(0),w(1),s(2),n(3) int cnt=4; while(cnt--){ for(int i=0; i3) dir=0; } if(cmd=='R'){ dir-=1; if(.. 2021. 10. 23.
[Leetcode,c++] Two Sum Two Sum - 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 twoSum(vector& nums, int target) { vectorans; unordered_mapm; for(int i=0; i 2021. 10. 23.