일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Class
- Generator
- 운영체제
- 30. Substring with Concatenation of All Words
- t1
- 315. Count of Smaller Numbers After Self
- 프로그래머스
- Python Code
- kaggle
- 파이썬
- concurrency
- Substring with Concatenation of All Words
- LeetCode
- 컴퓨터의 구조
- Python Implementation
- data science
- Decorator
- iterator
- 715. Range Module
- Convert Sorted List to Binary Search Tree
- 밴픽
- shiba
- Protocol
- 시바견
- 43. Multiply Strings
- DWG
- Regular Expression
- 109. Convert Sorted List to Binary Search Tree
- attribute
- Python
- Today
- Total
목록분류 전체보기 (407)
Scribbling
class Solution: def solveSudoku(self, board: List[List[str]]) -> None: """ Do not return anything, modify board in-place instead. """ num_left = 0 for i in range(9): for j in range(9): if board[i][j] == '.': num_left += 1 self.solver(board, num_left) def solver(self, board, num_left): if num_left == 0: return True # Search Blank -> (i, j) start_y, start_x = 0, 0 found_flag = False for t in range..
class Solution: def isValidSudoku(self, board: List[List[str]]) -> bool: for i in range(9): for j in range(9): if board[i][j] != '.': # 가로 for k in range(9): if k == j: continue if board[i][j] == board[i][k]: return False # 세로 for k in range(9): if k == i: continue if board[i][j] == board[k][j]: return False # 사각형 start_y = i // 3 * 3 start_x = j // 3 * 3 for y in range(start_y, start_y+3): for ..
생각보다는 쉽게 풀린다. class Solution: def isMatch(self, s: str, p: str) -> bool: n = len(p) m = len(s) # matched[i][j]: (i-1)th pattern matches (j-1)th string matched = [[False] * (m+1) for _ in range(n+1)] matched[0][0] = True for j in range(1, m+1): matched[0][j] = False for i in range(1, n+1): if p[i-1] == '*': matched[i][0] = matched[i-1][0] for i in range(1, n+1): for j in range(1, m+1): if p[i-1] ..
1. 웹 브라우저 웹 브라우저는 가상 머신 (Virtual Machine)이다. 웹 브라우저는 복잡한 명령어 집합을 완전히 소프트웨어로 구현한 추상적 컴퓨터이다. 다시 말하자면, 웹 브라우저는 인터프리터에 속한다. 브라우저는 복잡한 애플리케이션인 동시에 소프트웨어로 구현된 프로그래밍 가능한 컴퓨터이다. 브라우저의 개발자 콘솔 (Developer Console)을 떠올릴 수 있다. 1.1. URL (Uniform Resource Locator) 브라우저는 URL을 사용하여 HTTP 프로토콜을 통해 서버에게 문서를 Request 한다. 서버는 문서를 브라우저에 보내고, 브라우저는 문서를 표시한다. 여기서 문서는 HTML / XML 등의 다양한 마크업 언어로 작성될 수 있다. URL은 아래 그림처럼 세 가지 ..
Rotating a matrix 90 degrees clockwise can be achieved just by transposing + mirror reversing. class Solution: def rotate(self, matrix: List[List[int]]) -> None: """ Do not return anything, modify matrix in-place instead. """ m, n = len(matrix), len(matrix[0]) for i in range(m): for j in range(i+1, n): matrix[i][j], matrix[j][i] = matrix[j][i], matrix[i][j] for i in range(m): for j in range(n//2..
1. 어셈블리 언어 (Assembly Language) 컴퓨터는 (혹은 CPU는) 0과 1의 bit로 이루어진 기계어만을 이해할 수 있다. 사람이 기계어를 이용하여 코딩하려면, 무수히 많은 비트 조합을 다 외우고 있어야 할 것이다. 어셈블이 언어는 이러한 비트 조합을 추상화한 언어로, 보다 이해하기 쉬운 니모닉 (Mnemonics)를 통하여 명령어를 작성할 수 있도록 한다. 어셈블러 (Assembler)는 어셈블리 언어로 작성된 코드를 바탕으로 기계어 코드 (Machine Code)로 생성한다. 2. 고수준 언어 (High-Level Language) 고수준 언어는 어셈블리 언어보다 더 높은 추상화 단계에서 작동한다. 고수준 언어의 소스 코드 (Source Code)는 컴파일러 (Compiler)라는 프..
class Solution: def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]: ret = [] arr = [0] self.helper(ret, arr, candidates, target) return ret def helper(self, ret, arr, candidates, target): _sum = sum(arr) if _sum > target: return if _sum == target: ret.append(arr[1:]) return for candidate in candidates: last_input = arr[-1] if candidate >= last_input: next_arr = arr.c..
무지성 포칼포인트의 답... class Solution: def longestValidParentheses(self, s: str) -> int: if not s: return 0 mem = [0] * len(s) stack = [] length = 0 for i in range(len(s)): char = s[i] if char == '(': stack.append(char) length = 0 else: if not stack: length = 0 else: top = stack.pop() if top == '(': length += 2 if i - length >= 0 and s[i-length] == ')': length += mem[i-length] else: length = 0 mem[i] =..
* Note: shift left is the same as multiplying by two. class Solution: def divide(self, dividend: int, divisor: int) -> int: # Overflow if dividend == -2**31 and divisor == -1: return 2**31 - 1 # Positive? positive = (dividend > 0) is (divisor > 0) dividend = abs(dividend) divisor = abs(divisor) res = 0 subtract = divisor while divisor
class Solution: def myPow(self, x: float, n: int) -> float: if n == 0: return 1 if x == 1: return 1 if x == -1: if abs(n) % 2 == 0: return 1 else: return -1 if x == 0: return 0 n_sign = True if n > 0 else False res = 1 count = 0 while count < abs(n): multiplier = x step = 1 while step