This file contains hidden or 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 timeit | |
class TimeTrack: | |
def __init__(self, func): | |
start = timeit.default_timer() | |
func() | |
stop = timeit.default_timer() | |
print("Time to get %s" % (stop-start)) |
This file contains hidden or 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
Note: This just aligns the position of the textblock, not the text itself. |
This file contains hidden or 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 flatten(a): | |
return sum(a, []) | |
def local_minima(a): | |
if len(a) < 2: | |
return list(range(len(a))) | |
lmin = True | |
curr = list() | |
local_minima = list() |
This file contains hidden or 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
Note: This just aligns the position of the textblock, not the text itself. |