-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ff4f80
commit b68ed2e
Showing
52 changed files
with
569 additions
and
958 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# O(n) | ||
def max_power(s: str) -> int: | ||
mx = 1 | ||
count = 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# O(n) | ||
def summary_ranges(nums: list[int]) -> list[str]: | ||
ranges: list[list[int]] = [] | ||
for num in nums: | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +0,0 @@ | ||
from src.tba_trees.tree_height import tree_height_naive, tree_height_stack | ||
from .bank_queue import average_waiting_time | ||
from .brackets import brackets | ||
from .calculator import ( | ||
get_postfix_notation, | ||
split_by_tokens, | ||
evaluate_postfix, | ||
calculator, | ||
) | ||
from .max_stack import MaxStack | ||
from .net_packets import net_packets | ||
from .sliding_window import sliding_window_naive, sliding_window_deque | ||
|
||
__all__ = [ | ||
"brackets", | ||
"net_packets", | ||
"tree_height_naive", | ||
"tree_height_stack", | ||
"sliding_window_naive", | ||
"sliding_window_deque", | ||
"average_waiting_time", | ||
"get_postfix_notation", | ||
"split_by_tokens", | ||
"evaluate_postfix", | ||
"MaxStack", | ||
"calculator", | ||
] | ||
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# O(log x) | ||
def sqrt(x: int) -> int: | ||
if x < 2: | ||
return x | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# O(n) | ||
def product_except_self(nums: list[int]) -> list[int]: | ||
n = len(nums) | ||
res = [1] * (n + 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# O(n) | ||
def find_gcd(nums: list[int]) -> int: | ||
return gcd_euclid(min(nums), max(nums)) | ||
|
||
|
Oops, something went wrong.