- Today
- Total
목록분류 전체보기 (384)
작심삼일
문제 링크: https://leetcode.com/problems/compare-version-numbers/ 문제 Given two version numbers, version1 and version2, compare them. Version numbers consist of one or more revisions joined by a dot '.'. Each revision consists of digits and may contain leading zeros. Every revision contains at least one character. Revisions are 0-indexed from left to right, with the leftmost revision being revision 0..
문제 링크: https://leetcode.com/problems/sort-list/ 문제 Given the head of a linked list, return the list after sorting it in ascending order. 조건 The number of nodes in the list is in the range [0, 5 * $10^4$]. $-10^5$ Optional[ListNode]: if not head: return head array = [] while head.next: array.append(head.val) head = head.next array.append(head.val) array = sorted(array) ans = ListNode(array[0]) an..
문제 링크: https://leetcode.com/problems/clone-graph/ 문제 Given a reference of a node in a connected undirected graph. Return a deep copy (clone) of the graph. Each node in the graph contains a value (int) and a list (List[Node]) of its neighbors. class Node { public int val; public List neighbors; } 조건 The number of nodes in the graph is in the range [0, 100]. 1
문제 링크: https://leetcode.com/problems/excel-sheet-column-number/ 문제 Given a string columnTitle that represents the column title as appear in an Excel sheet, return its corresponding column number. For example: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 28 ... 조건 1
문제 링크: https://leetcode.com/problems/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 in the array. 조건 n == nums.length 1
문제 링크: https://leetcode.com/problems/remove-k-digits/ 문제 Given string num representing a non-negative integer num, and an integer k, return the smallest possible integer after removing k digits from num. 조건 1 0 and k > 0 and digit 0: ans.pop() k -= 1 ans = ''.join(ans).lstrip('0') if ans == '': return '0' return ans
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/Hy0Nj/btrtCVvxkFP/asajrp0E0kEk1WiULsDkEK/img.png)
문제 링크: https://leetcode.com/problems/combination-sum/ 문제 Given an array of distinct integers candidates and a target integer target, return a list of all unique combinations of candidates where the chosen numbers sum to target. You may return the combinations in any order. The same number may be chosen from candidates an unlimited number of times. Two combinations are unique if the frequency of ..
문제 링크: https://leetcode.com/problems/swap-nodes-in-pairs/ 문제 Given a linked list, swap every two adjacent nodes and return its head. You must solve the problem without modifying the values in the list's nodes (i.e., only nodes themselves may be changed.) 조건 The number of nodes in the list is in the range [0, 100]. 0