![](http://i1.daumcdn.net/thumb/C148x148.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/D2U1i/btqF5zbGjHM/JrQmWYDDt86ulffwtjCcX1/img.png)
List only def is_palindrom(s: str) -> bool: strs = [] # Using deque for char in s: if char.isalnum(): strs.append(char.lower()) while len(strs) > 1: if strs.pop(0) != strs.pop(): return False return True Using deque from collections import deque def is_palindrom(s: str) -> bool: strs = deque([]) for char in s: if char.isalnum(): strs.append(char.lower()) while len(strs) > 1: if strs.popleft() !=..
![](http://i1.daumcdn.net/thumb/C148x148.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/bzL55b/btqFZj6ml6d/E0Ujc9H6yifiRB8YWiaRhk/img.png)
1. Github에서 가져오기 url = '' df = pd.read_csv(url) 2. 로컬 드라이브 from google.colab import files uploaded = files.upload() import io df = pd.read_csv(io.BytesIO(uploaded['CSV FILE'])) 3. 드라이브 마운트 from google.colab import drive drive.mount('/content/drive') # 새로운 창에서 key 를 받아서 입력해야합니다. df = 'path to your csv' 작성 일인 7/23(목) 현재 코랩에서 드라이브 연결에 문제가 있어서... 다른 방법을 알아보던 중에 정리합니다.
![](http://i1.daumcdn.net/thumb/C148x148.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/2WQuc/btqE3eS9oFz/HzoucOY4ghlFCD7yPoNJ1K/img.png)
Question Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix. Note that it is the kth smallest element in the sorted order, not the kth distinct element. Example matrix = [ [ 1, 5, 9], [10, 11, 13], [12, 13, 15] ], k = 8, return 13. 처음 생각한 간단한 방식은 matrix를 flatten 한 뒤 그 리스트의 k-1번째 인덱스를 리턴하면 될 듯하여 만든 코드입니다. class Soluti..
![](http://i1.daumcdn.net/thumb/C148x148.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/cX9Cli/btqE1vAbkgY/YK1wNcRmwSrxZBGJunpUMK/img.png)
Medium 에서 글을 보다가 전부터 보던 streamlit 관련된 글이 있어서 다시 사용해본 후 쓰는 글입니다. streamlit 공식 페이지 예전에 한번 쓰려 했으나, 당시에는 버그 등이 너무 많아서 아쉬웠지만 이제는 안정화가 되었길 빌며 설치를 진행했습니다. 설치 pip install streamlit 기본 실행 streamlit hello Mapping, Animation, Plotting, Dataframe 등 다양한 데모를 확인 가능합니다. 원하는 파일 실행 시 streamlit run Example pip install opencv-python streamlit run https://raw.githubusercontent.com/streamlit/demo-self-driving/master/..
![](http://i1.daumcdn.net/thumb/C148x148.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/brxZm8/btqEHw1c8LQ/J9annksKIgGYY0W2Qiquu0/img.jpg)
Reverse Linked list # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def reverseList(self, head: ListNode) -> ListNode: prev = None curr = head while curr: nex = curr.next curr.next = prev prev = curr curr = nex return prev Linked List Palindrome # Definition for singly-linked list. # class ListNode..
![](http://i1.daumcdn.net/thumb/C148x148.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/xL5m6/btqEGgjDMUE/KdnKuK6gNv0ELi2XoBLVfK/img.jpg)
Question Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. Solution class Solution: def searchInsert(self, nums: List[int], target: int) -> int: return 1일1깡 방법 if target in nums: return nums.index(target) else: nums.append(target) nums.sort() return nums.index(target) Binary Search low = 0 hi..
![](http://i1.daumcdn.net/thumb/C148x148.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/C9yhz/btqEFWy5dko/xxEqOlAclo79tklbCaMiqK/img.jpg)
Description Given two binary strings, return their sum (also a binary string). The input strings are both non-empty and contains only characters 1 or 0. Answer class Solution: def addBinary(self, a: str, b: str) -> str: i = int(a,2) j = int(b,2) # ans = i+j # return bin(ans)[2:] return format(i+j,'b') 진수 변환 >> bin(30) '0b1110' >> oct(30) '0o36' >> hex(30) '0x1e' Format 함수 # 접두어 제외하기 >> format(0b..
![](http://i1.daumcdn.net/thumb/C148x148.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/d19AYD/btqEGBUEqAf/a7t4sQlucGMa7JFKzSReP0/img.jpg)
Problem no.93 Restore IP Address Question: Given a string containing only digits, restore it by returning all possible valid IP address combinations. A valid IP address consists of exactly four integers (each integer is between 0 and 255) separated by single points. Solution: class Solution: def restoreIpAddresses(self, s: str) -> List[str]: l = len(s) if l 4*3: return [] ans = set() ..
- Total
- Today
- Yesterday
- 나는리뷰어다
- 한빛미디어
- lllm
- Fine-Tuning
- Container
- feed-forward
- 책리뷰
- kubernetes context
- book
- kubens
- Shell
- Kubernetes
- 키보드
- BASIC
- palindrome
- 파이썬
- Algorithm
- leetcode
- Gemma
- csv
- Python
- docker
- K8S
- LLM
- Git
- Binary
- collator
- go
- AWS
- error
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |