algorithm 24

316. Remove Duplicate Letters [R]

https://leetcode.com/problems/remove-duplicate-letters/ Remove Duplicate Letters - 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 항상 자신이 없는 스택 문제를 오랜만에 풀어봤다. 결국 제한 시간 안에 못풀었다. 대충 250케이스중 200몇개만 통과하고 예외 케이스가 발생. 코드를 딱 봐도 ... 복잡. class Solution: def removeDuplicateLetters(self, s: s..

algorithm 2020.10.18

1405. Longest Happy String

https://leetcode.com/problems/shopping-offers/ Shopping Offers - 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 a, b, c의 갯수가 주어지고 aaa, bbb, ccc와 같이 연속된 3개의 문자가 나오지 않는 선에서 가장 긴 스트링을 리턴하는 문제 한 번 재귀로 접근해보았는데... 계속 예외케이스가 발생하고 결국 중단. 재귀로 푼 다음 메모이제이션으로 최적화가 가능할 것 같았는데... ccaccbcc 예시에서 ..

algorithm 2020.09.14

638. Shopping Offers

https://leetcode.com/problems/shopping-offers/ Shopping Offers - 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 음.. 요즘에는 예전과는 다르게, 최적 값 찾는 문제를 테이블로 어떻게 접근할 것인지 부터 생각하고있네 예전엔 반대였는데 아무튼, 긍정적인 신호고 반대로 DP문제에서 테이블 접근에 있어서 답이 도저히 안나 올 때는 그냥 직관적으로 recursion을 이용해 코드를 풀어 쓰고, memoization을 적..

algorithm 2020.09.12

300. Longest Increasing Subsequence

https://leetcode.com/problems/longest-increasing-subsequence/ Longest Increasing 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 윽 어려웠다! 어레이가 주어졌을 때 증가하는 수열로만 이루어지면서 가장 긴 subseq를 찾는 문제다. 처음엔 정렬하고나서 인덱스로 뭐 어떻게 해보면 되지 않을까 생각해봤는데, 정렬하고 나서도 결국 증가하는 인덱스로만 이루어진 배열을 찾아야되서 결국..

algorithm 2020.09.06