전체 글 207

[leetcode][Medium][Stack] 155. Min Stack 풀이, 해설 (python)

https://leetcode.com/problems/min-stack/ Min Stack - LeetCode Can you solve this real interview question? Min Stack - Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. Implement the MinStack class: * MinStack() initializes the stack object. * void push(int val) pushes t leetcode.com 1차 풀이 가벼운 스택 문제일거라 생각했는데, getMin 부분에서 어떻게 O(1)을 만들까 잠깐 고민했다. 그러다가 ..

[leetcode][Easy][Stack] 20. Valid Parentheses 풀이, 해설 (python)

https://leetcode.com/problems/valid-parentheses/ Valid Parentheses - LeetCode Can you solve this real interview question? Valid Parentheses - Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: 1. Open brackets must be closed by the sam leetcode.com 1차 풀이 단순한 스택 문제라 간단히 풀었지만, 조건이 추가가 되면서 좀 복잡한 풀이가 되..

[leetcode][Hard][Two Pointers] 42. Trapping Rain Water 풀이, 해설 (python) : 해설 참고해서 푼 풀이

https://leetcode.com/problems/trapping-rain-water/ Trapping Rain Water - LeetCode Can you solve this real interview question? Trapping Rain Water - Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining. Example 1: [https://assets.leetcode.com/upl leetcode.com 한시간 정도 풀릴까 말까 하다가, 풀리지 않아서 ... 결국 해설을 본 풀이이다. 일단,..

[leetcode][Medium][Two Pointers] 11. Container With Most Water 풀이, 해설 (python)

https://leetcode.com/problems/container-with-most-water/ Container With Most Water - LeetCode Can you solve this real interview question? Container With Most Water - You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]). Find two lines that toget leetcode.com 1차 풀이 일단 단순하게, O(n^2)로 접근했다. 그랬더니 ..

[leetcode] 15. 3Sum 풀이, 해설 (python)

https://leetcode.com/problems/3sum/ 3Sum - LeetCode Can you solve this real interview question? 3Sum - Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0. Notice that the solution set must not contain du leetcode.com 1차 풀이 접근법을 못찾아서 O(n*n)으로 푸는 방법을 시도했다. a,b를 찾아서 -(a + b)값이 다른 배열안에 있는지 확인하는 방..

python. isalnum과 isalpha

- isalnum : https://zetawiki.com/wiki/%ED%8C%8C%EC%9D%B4%EC%8D%AC_isalnum()- > 문자열이 알파벳([a-zA-Z])과 숫자([0-9])로만 구성되었는지 확인하는 파이썬 문자열 메소드 - isalpha : https://zetawiki.com/wiki/%ED%8C%8C%EC%9D%B4%EC%8D%AC_isalpha() > 문자열이 알파벳([a-zA-Z])으로만 구성되었는지 확인하는 파이썬 문자열 메소드 그 외) 파이썬 isdigit() 파이썬 islower() 파이썬 isupper()

개발/파이썬 2023.10.28

intellij. 서식 지우고 복사하는 법 (copy as plain text)

intellij 에 있는 소스코드를 복사 붙여넣기 하다보면 특정 사이트의 경우, 서식과 함께 복사되는 경우가 있다. 이 경우, intelli > 마우스 오른쪽 클릭 > Copy/Paste Special > Copy as Plain Text 로 하면 해결이 된다. 하지만 나같은 경우, 해당 단축키가 설정이 안되어 있었다. 이 경우 Settings > Keymap > "Copy as Plain Text" 의 단축키를 설정하면된다.

개발/꿀팁 2023.10.27

git. merge strategy

회사에서 merge 전략을 구분지어서 사용하고 있어서 관련 정책을 조사해보았다. - 개발 브랜치로 sync할때는 merge commit 권장 - 실제 운영으로 배포할때는 squash strategy 권장 1. create a merge commit - 가장 심플하게, 커밋 내역과 함께 merge commit이 생성 2. squash and merge - merge할 브랜치의 commit을 전부 하나의 commit으로 합친 후 타겟 브랜치에 병합 - 장점은 merge commit이 남아서 merge된 브랜치가 있었다는 것을 히스토리에서 알아볼 수 있음 - 단점은 merge된 브랜치의 변경 내역이 하나의 commit으로만 남기 때문에 어떠한 과정으로 변경되었는지에 대한 정보를 알 수 없음 3. rebase ..

개발 2023.10.24

jsp. 주석 종류 (클라이언트 미노출하고 싶다면 <%-- --%>)

jsp에서 주석을 달때, 화면단에 노출하지 않고 참고용으로만 작성할 수 있는 방법을 찾다가 한 번 정리해봤다. jsp관련글들은 구글에서 검색했을때 최신글들이 없다... 1. jsp 주석 서버에만 남아있고, 화면단에 노출 안된다. 클라이언트가 볼 수 없다. 2. java 주석 //주석내용 /* 주석내용 */ 서버에만 남아있고, 화면단에 노출 안된다. 3. html 주석 화면단에 노출된다. 출력결과에 포함된다. 참고 블로그 https://m.blog.naver.com/kimkwon429/220758472450 https://blog.naver.com/youseon97/222989973354

개발/자바 2023.10.24

[leetcode] 167. Two Sum II - Input Array Is Sorted 풀이, 해설 (python)

문제 링크 https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/ Two Sum II - Input Array Is Sorted - LeetCode Can you solve this real interview question? Two Sum II - Input Array Is Sorted - Given a 1-indexed array of integers numbers that is already sorted in non-decreasing order, find two numbers such that they add up to a specific target number. Let these two n leetcode.com 1차 풀이 단순하게 모..

반응형