Skip to content

Commit

Permalink
optimize code structure
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangyang.qi committed Nov 9, 2022
1 parent cc17d02 commit 0912e87
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Leetcode/tools.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import time


def timer(func):
def wrapper(s):
start_time = time.time()
str_len = func(s)
end_time = time.time()
print(f"func name: {func.__name__}, total cost: {round((end_time - start_time) * 1000 * 1000, 2)} ns")
return str_len
return wrapper

0 comments on commit 0912e87

Please sign in to comment.