leetcode
-
2021-01-21] Find the Most Competitive SubsequenceIT/자기계발 ( Leetcode ) 2021. 1. 22. 01:16
오늘의 문제: leetcode.com/explore/challenge/card/january-leetcoding-challenge-2021/581/week-3-january-15th-january-21st/3611/ Explore - LeetCode LeetCode Explore is the best place for everyone to start practicing and learning on LeetCode. No matter if you are a beginner or a master, there are always new topics waiting for you to explore. leetcode.com 문제의 난이도는 Medium인데 나에겐 왤케 어려운지.. 문제를 풀려고만 하지말고, 알고리..
-
2021-01-20] Valid ParenthesesIT/자기계발 ( Leetcode ) 2021. 1. 20. 23:27
오늘의 문제: leetcode.com/explore/challenge/card/january-leetcoding-challenge-2021/581/week-3-january-15th-january-21st/3610/ 문제 예시를 보며 설명해보자. 입력값으로 주어지는 문자열은 소, 중, 대 괄호만으로로 이뤄진다. 주어진 값에 대해서 괄호가 잘 닫혔는지, 이상은 없는지 확인하는 문제이다. 각 괄호들로 알맞게 닫혀져있는지 확인하여 참 ,거짓을 판별하자. 먼저, 실패조건을 생각해본다. 1) 주어진 문자열의 길이는 무조건 짝수여야한다. ( 쌍으로 열고 닫히기 때문에 ) if len(s)%2==1: # 주어진 s의 길이가 홀수면 False return False 2) 닫히는 괄호가 먼저 나오면 무조건 실패 ( 예시..
-
2020-01-15] Get Maximum in Generated ArrayIT/자기계발 ( Leetcode ) 2021. 1. 15. 21:50
오늘의 문제: leetcode.com/explore/challenge/card/january-leetcoding-challenge-2021/581/week-3-january-15th-january-21st/3605/ Explore - LeetCode LeetCode Explore is the best place for everyone to start practicing and learning on LeetCode. No matter if you are a beginner or a master, there are always new topics waiting for you to explore. leetcode.com 간만에 기분좋게 문제를 풀어 마음이 좋구만. 예시를 보며 문제를 파악해보자. 입력값 n이 ..
-
2021-01-14] Boats to Save PeopleIT/자기계발 ( Leetcode ) 2021. 1. 14. 00:28
오늘의 문제: leetcode.com/explore/challenge/card/january-leetcoding-challenge-2021/580/week-2-january-8th-january-14th/3602/ Explore - LeetCode LeetCode Explore is the best place for everyone to start practicing and learning on LeetCode. No matter if you are a beginner or a master, there are always new topics waiting for you to explore. leetcode.com 문제에 대해서 간단히 생각할땐 쉬웠는데, 막상 파고드니 어려워 죽는줄.. 문제 예시를 보며 ..
-
2021-01-13] Add Two NumbersIT/자기계발 ( Leetcode ) 2021. 1. 13. 12:41
오늘의 문제: leetcode.com/explore/challenge/card/january-leetcoding-challenge-2021/580/week-2-january-8th-january-14th/3601/ 확실히 주말에 힘든 문제인것 같은 느낌이다! 다행이 오늘 문제도 풀 수 있었다~ 자 예시를 보며 문제를 이해하자. 입력 값으로 ListNode 2개를 준다. 그 값이 더해져 값을 넘겨주는 것. 설명을 보면 결국 ListNode의 합산된 값의 새로운 List를 달라는 말이다. 문제풀이 1차) list의 시작부터 l1의 첫번재값*10의0승 = 첫째자리의 값 을 이용하여, list 마다 가진 값을 만들고, 둘을 합해 역순으로 list를 만들어 보는 방법을 선택했다. # Definition for s..
-
2021-01-12] Merge Sorted ArrayIT/자기계발 ( Leetcode ) 2021. 1. 12. 00:00
오늘의 문제: leetcode.com/explore/challenge/card/january-leetcoding-challenge-2021/580/week-2-january-8th-january-14th/3600/ 간만쓰 쉬운 문제였던것 같다..ㅎㅎ 주말엔 시간이 많을테니 어려운 문제를 주는지 토/일은 문제가 힘들어서 고통이었다ㅜ 이 문제는 array관련 문제로 예시를 보며 이해해보자. nums1의 길이는 두 list를 합칠만큼의 공간이 주어지고, 실제 값이 있는 길이는 m으로 주어진다. 이를 sort하여 값을 주면 완성. 주의할 점은 return값이 없고 주어진 nums1 list에 sort된 값을 넣어서 반환하면 된다. 문제풀이) class Solution(object): def merge(self,..
-
2021-01-11] Valid SudokuIT/자기계발 ( Leetcode ) 2021. 1. 11. 18:52
오늘의 문제: leetcode.com/problems/valid-sudoku/ Valid Sudoku - 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 sudoku에 대해서 이해하고 있다면, 문제는 쉬울 것이다, 총 9X9 행렬이 주어지고, sudoku로써 맞는지 검증하는 문제이다. 예시의 그림을 보며 이해해 보자. sudoku의 조건은 결국 아래 2가지로 정리될 것 같다. 1) 각 n행,n열 각각 모든 숫자들이 1-9 까지 중복되지 않고 들어간다. 2) 각 s..
-
2021-01-10] Create Sorted Array through InstructionsIT/자기계발 ( Leetcode ) 2021. 1. 11. 00:14
오늘의 문제: leetcode.com/explore/challenge/card/january-leetcoding-challenge-2021/580/week-2-january-8th-january-14th/3599/ 이번 문제는 이해가 조금 어려웠다.. ( 아직 필자는 답을 만들진 못했다.) 예시를 보며 문제를 이해해보자. 입력값으로 배열을 주어지면, 정렬을 하면서 생긴, cost 값에 대해서 최소값에 대해 합을 구하는 문제이다. cost라는 것의 비교값으로 주어지는 것들은 정렬을 하면서 정렬값이 되었을때, 왼쪽의 원소의 개수와 오른쪽의 원소의 개수이다. 1번 예시를 보며 이해해보자. 1) 첫번째 값 1을 넣으면 값이 하나이기에 양옆의 값은 0 , 0 min은 0이고, 2) 두번째 값 5를 넣으면 5는 1..