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
class Solution: | |
def maxProfit(self, prices: List[int]) -> int: | |
if len(prices) < 2: | |
return 0 | |
low_price = prices[0] | |
max_profit = 0 | |
for i in range(1, len(prices)): | |
if prices[i] > low_price: |
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
class Solution: | |
def permute(self, nums: List[int]) -> List[List[int]]: | |
permutations = [[]] | |
for choice in nums: | |
new_permutations = [] | |
for perm in permutations: | |
perm.append(choice) | |
for j in range(len(perm)): |
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
class Solution: | |
def combine(self, n: int, k: int) -> List[List[int]]: | |
nums = list(range(1, n + 1)) | |
combinations = [[]] | |
for depth in range(0, k): | |
new_combinations = [] | |
for combo in combinations: | |
start_index = nums.index(combo[-1]) + 1 if len(combo) > 0 else 0 |
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
class Solution: | |
def permute(self, nums: List[int]) -> List[List[int]]: | |
result = [] | |
def backtracking(permutations, path, options): | |
if len(path) == len(options): | |
permutations.append(path[:]) | |
else: | |
for option in options: |
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
class Solution: | |
def combine(self, n: int, k: int) -> List[List[int]]: | |
nums = list(range(1, n + 1)) | |
combinations = [] | |
def backtracking(results, path, depth, options): | |
if depth == 0: | |
results.append(path[:]) | |
else: |
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
class Solution: | |
def permute(self, nums: List[int]) -> List[List[int]]: | |
result = [] | |
def permute_helper(ans: List[int], cur: List[int], options: List[int]): | |
if len(options) == 0: | |
ans.append(cur) | |
else: | |
for index, choice in enumerate(options): |
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
class Solution: | |
def combine(self, n: int, k: int) -> List[List[int]]: | |
nums = list(range(1, n + 1)) | |
combinations = [] | |
def combine_helper(ans: List[int], path: List[int], options: List[int], count: int): | |
if count == 0: | |
ans.append(path) | |
else: |
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
constructor(props) { | |
super(props); | |
this.state = { height: 512 }; | |
this.updateWindowDimensions = this.updateWindowDimensions.bind(this); | |
} | |
componentDidMount() { | |
this.updateWindowDimensions(); | |
window.addEventListener("resize", this.updateWindowDimensions.bind(this)); | |
} |
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
I have run an nginx container... | |
docker ps | |
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | |
6d67de07731d nginx "nginx -g 'daemon ..." 40 minutes ago Up 40 minutes 80/tcp, 443/tcp epic_goldberg | |
I want to use Debian for debug: | |
docker run -it --pid=container:6d67de07731d --net=container:6d67de07731d --cap-add sys_admin debian | |
I can see the nginx process: |
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
desc 'Automate the Config Setup for New Environments' | |
task :setup_workspace do | |
dev_example = Rails.root + 'config/env/development.example.env' | |
dev_target = Rails.root + 'config/env/development.env' | |
FileUtils.cp(dev_example, dev_target) | |
test_example = Rails.root + 'config/env/test.example.env' | |
test_target = Rails.root + 'config/env/test.env' | |
FileUtils.cp(test_example, test_target) |