π programmers H-Index
def solution(citations): citations.sort() for num, val in enumerate(citations): if val >= len(citations) - num: return len(citations) - num return 0
λ¬Έμ λ§ μ μ΄ν΄νλ©΄ ν μ μλ λ¬Έμ μ΄λ€.
λ¬΄μ¨ μ리μΈκ°... νμμ°λ§ νλνλ 보면 μ¬μ΄ λ¬Έμ μ΄λ€.
μ¬μ€ μ΄λ―Έ νμλ λ¬Έμ μ΄μ§λ§ campμμ μ§ννλ μκ³ λ¦¬μ¦ λ°μμ λμ¨ λ¬Έμ μ¬μ λ€μ νμ΄λ³΄μλ€.
π programmers μ¬λ°λ₯Έ κ΄νΈ μ€ν/ν
def solution(ss): result = [] for s in ss: if s == '(': result.append(s) else: if result == []: return False result.pop() return result == []
μ΄ λ¬Έμ λ νμλ λ¬Έμ μ΄μ§λ§ μκ³ λ¦¬μ¦ μμ μ μμ΄μ λ€μ νμ΄λ³΄μλ€.
π url μ΄λ―Έμ§ κ°μ²΄λ‘ λ³ν
async function convertURLtoFile(url) { const response = await fetch(url); const data = await response.blob(); const ext = url.split(".").pop(); // url ꡬ쑰μ λ§κ² μμ ν κ² const filename = url.split("/").pop(); // url ꡬ쑰μ λ§κ² μμ ν κ² const metadata = { type: `image/${ext}` }; return new File([data], filename, metadata); };
window.onload = async() => { const test_image = 'http://127.0.0.1:8000/media/filter/8b74b3ca29944b7bb6e3c7d25663aaba.jpg' const result1 = convertURLtoFile(test_image); let temp = undefined await result1.then(response => { temp = response // console.log(response) }) console.log(temp) }
promise λ°μ΄ν°λ₯Ό 보λ κ²μ΄ μ΄λ €μ μ§λ§ λ°λμ λμ κ³ μνλ©΄μ λΉλκΈ° ν¨μλ₯Ό κ±°μ³μ¨ λ°μ΄ν°λ₯Ό 보λ λ°©λ²μ μ μ΄ν΄νλ€...!
μ€λ λ!