This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution(object): | |
def reorderLogFiles(self, logs): | |
""" | |
:type logs: List[str] | |
:rtype: List[str] | |
""" | |
digit_log=[] | |
let_temp=[] | |
let=[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 원하는 개수만큼 값을 입력받아 마지막 n개를 저장 | |
n = int(input('정수를 몇개 저장할까요?')) | |
a= [None]*n # 입력받은 값을 저장하는 배열 | |
cnt = 0 # 정수를 입력받은 개수 | |
while True: | |
a[cnt%n]=int(input((f'{cnt+1}번째정수를 입력하세요'))) | |
cnt+=1 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.getElementById("save").addEventListener("click", function () | |
{ | |
var user = document.getElementById("user").value ; | |
//localStorage["user"] = user ; | |
localStorage.setItem("user", user) ; | |
alert("gmail id saved") ; | |
console.log("gmail id saved") | |
} , false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
url = "https://finance.naver.com/item/main.nhn?code=034220" | |
result = requests.get(url) | |
bs_obj = BeautifulSoup(result.content,"html.parser") | |
no_today = bs_obj.find("p", {"class": "no_today"}) # 태그 p, 속성값 no_today 찾기 | |
blind = no_today.find("span") # 태그 span, 속성값 blind 찾기 | |
now_price = blind.text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
with open('C:\\Users\\gnvid\\PycharmProjects\\telegramBot\\stock_list.json', 'r', encoding='UTF8') as f: | |
json_data = json.load(f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Any, Sequence | |
def bin_search(a : Sequence, key : Any)-> int: | |
'''시퀀스 a에서 key와 일치하는 원소를 이진 검색''' | |
pl =0 | |
pr= len(a)-1 | |
while True: | |
pc=(pl+pr)//2 # 중앙 우너소의 인덱스 | |
if a[pc]==key: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 재귀함수 | |
def binary_search_rec(seq, target, low,high): | |
if low > high: | |
return None | |
mid = (low+high)//2 | |
if target == seq[mid]: | |
return mid | |
elif target<seq[mid]: | |
return binary_search_rec(seq, target, low,mid-1) | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 반복문 | |
def binary_search_iter(seq, target): | |
high , low=len(seq),0 | |
while low < high: | |
mid = (high+low)//2 | |
if target ==seq[mid]: | |
return mid | |
elif target<seq[mid]: | |
high=mid | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Node(object): | |
def __init__(self,value=None, pointer=None): | |
self.value = value | |
self.pointer=None | |
class LinkedQueue(object): | |
def __init__(self): | |
self.head=None | |
self.tail=None | |
self.count=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Node(object): | |
def __init__(self, value=None,pointer=None): | |
self.value=value | |
self.pointer=pointer | |
class Stack(object): | |
def __init__(self): | |
self.head=None | |
self.count=0 | |