일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- kaggle
- Decorator
- Python
- Generator
- 715. Range Module
- attribute
- 파이썬
- 운영체제
- Python Implementation
- 315. Count of Smaller Numbers After Self
- 컴퓨터의 구조
- t1
- iterator
- 프로그래머스
- Regular Expression
- 30. Substring with Concatenation of All Words
- 시바견
- Protocol
- LeetCode
- data science
- Convert Sorted List to Binary Search Tree
- Class
- concurrency
- 109. Convert Sorted List to Binary Search Tree
- Python Code
- 43. Multiply Strings
- 밴픽
- DWG
- Substring with Concatenation of All Words
- shiba
Archives
- Today
- Total
목록ZigZag Conversion (1)
Scribbling
LeetCode: 6. ZigZag Conversion
class Solution: def convert(self, s: str, numRows: int) -> str: if numRows == 1: return s board = [[] for _ in range(numRows)] denom = 2 * numRows - 2 for i, char in enumerate(s): remainder = i % denom if remainder < numRows: board[remainder].append(char) else: board[2 * numRows - remainder - 2].append(char) ret = '' for i in range(len(board)): for j in board[i]: ret += j return ret
Computer Science/Coding Test
2021. 8. 16. 15:55