일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
- HashTable
- Depth-first Search
- DP
- matrix
- binary search
- 미디움
- 쉬움
- list
- 리트코드
- 재귀
- Array
- sorting
- easy
- recursive
- two pointers
- 중간
- 이진트리
- string
- 문자열
- backtracking
- Python
- math
- Binary
- binary tree
- leetcode
- tree
- hash table
- Medium
- linked list
- dfs
- Today
- Total
목록Algorithm/LeetCode (135)
부부의 코딩 성장 일기
1. 문제 링크 Binary Tree Postorder Traversal - LeetCode Binary Tree Postorder Traversal - LeetCodeCan you solve this real interview question? Binary Tree Postorder Traversal - Given the root of a binary tree, return the postorder traversal of its nodes' values. Example 1: [https://assets.leetcode.com/uploads/2020/08/28/pre1.jpg] Input: root = [1,nuleetcode.com2. 문제 설명 트리 순회 위키피디아 트리 순회 - 위키백과, 우리 모두..
1. 문제 링크 https://leetcode.com/problems/single-number/ Single Number - LeetCode Can you solve this real interview question? Single Number - Given a non-empty array of integers nums, every element appears twice except for one. Find that single one. You must implement a solution with a linear runtime complexity and use only constant leetcode.com 2. 문제 설명 정수로 구성된 nums가 주어졌을 때, 한 element만을 제외하곤, 모든 e..
1. 문제 링크 Linked List Cycle - LeetCode Linked List Cycle - LeetCode Can you solve this real interview question? Linked List Cycle - Given head, the head of a linked list, determine if the linked list has a cycle in it. There is a cycle in a linked list if there is some node in the list that can be reached again by continuo leetcode.com 2. 문제 설명 주어진 연결 리스트(Linked List)가 사이클(고리)를 포함하는 지 판단하는 문제 리트 ..
1. 문제 링크 Valid Palindrome - LeetCode Valid Palindrome - LeetCode Can you solve this real interview question? Valid Palindrome - A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric cha leetcode.com 2. 문제 설명 주어진 문자열이 좌우대칭인 지 확인하여 True, False를 반환 단, 기호는 제외하고 숫자와 ..
1. 문제 링크 https://leetcode.com/problems/longest-palindromic-substring/ str: result_len = 0 #대칭인 문자열의 길이 result ='' #대칭인 문자열 if len(s)= 0 and j < n and s[i] == s[j]: i, j = i - 1, j + 1 return s[i + 1:j] for k in range(n): ans = max(helper(k, k), helper(k, k + 1), ans, key=len) # helper(k, k) for odd length, helper(k, k+1) for even length return ans 5. 배운 점 확실히 난이도가 medium인 문제들은 단순히 이중 삼중 포문으로는 ti..
1. 문제 링크 Longest Substring Without Repeating Characters - LeetCode 2. 문제 설명 주어진 문자열에 포함된 문자열 중 중복된 문자가 없는 것 중 길이의 최댓값을 반환 예시) s = "abcabcbb"이면 "abc"가 가장 길기 때문에 3, s = "bbbbb"이면 "b"가 가장 길기 때문에 1, s = "pwwkew"이면 "wke"가 가장 길기 때문에 3 3. 처음 풀이 왼쪽을 고정 후 오른쪽은 한칸씩 이동하며 새로운 문자가 등장하면 현재 문자열을 temp에 저장 이미 나온 문자가 등장하면 왼쪽을 한칸 이동하고 temp를 비운 후 반복 temp를 비울 때 마다 이전까지 구한 최댓값 result와 현재 문자열 길이 중 최댓값으로 result 업데이트 매번..
1. 문제 링크 https://leetcode.com/problems/add-two-numbers/ Add Two Numbers - LeetCode Can you solve this real interview question? Add Two Numbers - You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and leetcode.com 2. 문제 설명 두 개의 연결리스트는 역순으로 된 숫자를 나타내고, 각 노드는 한 ..
1. 문제 링크 Best Time to Buy and Sell Stock - LeetCode Best Time to Buy and Sell Stock - LeetCode Can you solve this real interview question? Best Time to Buy and Sell Stock - You are given an array prices where prices[i] is the price of a given stock on the ith day. You want to maximize your profit by choosing a single day to buy one stock and choosin leetcode.com 2. 문제 설명 하루하루 주식 가격이 기록된 리스트를 입력받..