일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Python
- easy
- matrix
- DP
- leetcode
- string
- Medium
- hash table
- recursive
- 쉬움
- 이진트리
- binary search
- backtracking
- 문자열
- math
- 리트코드
- 재귀
- linked list
- HashTable
- binary tree
- 중간
- list
- Array
- tree
- Binary
- two pointers
- Depth-first Search
- 미디움
- sorting
- dfs
- Today
- Total
목록easy (39)
부부의 코딩 성장 일기
1. 문제 링크 https://leetcode.com/problems/reverse-bits/ Reverse Bits - LeetCode Can you solve this real interview question? Reverse Bits - Reverse bits of a given 32 bits unsigned integer. Note: * Note that in some languages, such as Java, there is no unsigned integer type. In this case, both input and output will be given as a signed leetcode.com 2. 문제 설명 주어진 정수를 2진법으로 나타낸 후 이를 앞뒤 역순으로 뒤집은 수를 10진법..
1. 문제 링크 https://leetcode.com/problems/majority-element/ Majority Element - LeetCode Can you solve this real interview question? Majority Element - Given an array nums of size n, return the majority element. The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume that the majority element always exists leetcode.com 2. 문제 설명 크기가 n인 배열이 주어졌을 때, majority element를 반환..
1. 문제 링크 2. 문제 설명 1이 주어지면 A, 26이 주어지면 Z 27이 주어지면 AA, 28이 주어지면 AB 와 같은 규칙으로 수가 주어졌을 때 문자열을 반환 즉 엑셀의 n번째 열이름을 생각하면 되고 A부터 Z까지 26개이니 26진법으로 생각 26진법이면 26으로 나눈 나머지가 0부터 25까지 나옴 그런데 A~Z까지 0을 나타내는 수가 없다는 것에 유의, 즉 0이 아니라 1이 A가 되고 26이 Z가 되어 1부터 26까지 나와서 하나의 차이가 존재함 3. 처음 풀이 class Solution: def convertToTitle(self, columnNumber: int) -> str: #26으로 나눈 나머지가 0부터 25까지이니 0:'A' 부터 25:'Z'에 대응시켜둔다. #1이 주어지면 1을 뺀 ..
1. 문제 링크 https://leetcode.com/problems/intersection-of-two-linked-lists/ 2. 문제 설명 사이클이 없는 두 개의 연결 리스트(Linked List)가 주어졌을 때 교차하는 곳을 시작점으로 하는 연결 리스트를 반환하는 문제 예시) a1 → a2 → c1 → c2 → c3와 b1 → b2 → b3 → c1 → c2 → c3가 주어지면 c1에서 교차하기 때문에 연결 리스트 c1 → c2 → c3를 반환 3. 처음 풀이 a1을 시작으로 .next를 통해 한 칸 씩 앞으로 가며 끝까지 집합 seen에 저장하고 b1부터 시작하여 seen 에 있는 지 판단하여 아니면 한 칸 전진, 이미 나온 노드면 교차점으로 판단 하여 반환 시간 복잡도 O(m+n) # Def..
1. 문제 링크 https://leetcode.com/problems/binary-tree-preorder-traversal/ Binary Tree Preorder Traversal - LeetCode Can you solve this real interview question? Binary Tree Preorder Traversal - Given the root of a binary tree, return the preorder traversal of its nodes' values. Example 1: [https://assets.leetcode.com/uploads/2020/09/15/inorder_1.jpg] Input: root = [1, leetcode.com 2. 문제 설명 이진 트리의 r..
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를 반환 단, 기호는 제외하고 숫자와 ..