Skip to content

Instantly share code, notes, and snippets.

View aliwo's full-sized avatar
๐Ÿ 
Working from home

์ •์Šน์› aliwo

๐Ÿ 
Working from home
View GitHub Profile
# ์ข…๋งŒ๋ถ์—์„œ ํ’€์—ˆ๋˜ ๋ฌธ์ œ. ์‚ผ๊ฐํ˜• ๋ชจ์–‘๋งŒ ๋‹ค๋ฅด๋‹ค.
# cache[i][j] ๋ณด๋‹ค f ์ŠคํŠธ๋ง์„ ์‚ฌ์šฉํ•œ 1์ค‘ dict ๊ฐ€ ํ›จ์”ฌ ๋น ๋ฅด๋‹ค.
# ์ด๊ฒŒ ๋ฐ˜๋ณต์œผ๋กœ ํ’€ ์ˆ˜ ์žˆ๋Š” ๋ฌธ์ œ์ธ๊ฐ€?
cache = {}
def move(triangle, i, j):
'''
ํ˜„์žฌ ์œ„์น˜์—์„œ ๋‚ด๋ ค๊ฐ”์„ ๋–„ ์–ป์„ ์ˆ˜ ์žˆ๋Š” ์ตœ๋Œ“๊ฐ’์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
solution = lambda t, l = []: max(l) if not t else solution(t[1:], [max(x,y)+z for x,y,z in zip([0]+l, l+[0], t[0])])
package buv.co.kr.util.youtube;/*
* Copyright (c) 2012 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
def alter_alpha(to):
num = ord(to)
return num - 65 if num < 79 else 90 - num + 1
def traverse(done, i):
# TODO ; left_cnt ๋ณด๋‹ค right_cnt ๊ฐ€ ํฌ๋ฉด right ํƒ์ƒ‰์„ ์ค‘๋‹จ ํ•˜๋Š” ์ตœ์ ํ™”๊ฐ€ ๊ฐ€๋Šฅํ• ๊นŒ? ๋‹ต์— ์˜ํ–ฅ์ด ์—†์„๊นŒ?
# ๊ธฐ์ € ์‚ฌ๋ก€
if False not in done:
@aliwo
aliwo / sums.py
Created May 25, 2019 13:11
์žฌ๊ท€ํ˜ธ์ถœ sum ๊ณผ ๋ถ„ํ• ์ •๋ณต sum
import dis
def recursive_sum(n):
print('recursive ํ˜ธ์ถœ', n)
if n == 1:
return 1
return n + recursive_sum(n-1)
@aliwo
aliwo / holleywood.py
Last active May 24, 2019 03:15
ํ• ๋ฆฌ์šฐ๋“œ ๋ฒ•์น™
class Mother:
my_varialbe = 3
def _func(self):
print('func ํ˜ธ์ถœ')
def func_caller(self):
print('์—ฌ๊ธฐ์— ๋กœ๊ทธ๋ฅผ ์“ฐ๋ฉด ๋ฉ๋‹ˆ๋‹ค: {}'.format(self.my_variable))
self.func()
@aliwo
aliwo / hi.py
Last active February 15, 2019 12:17
๊ฐ€์œ„๋ฐ”์œ„๋ณด!
# hi