int calculate(int bottom, int top)
{
if (top > bottom)
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
#!/usr/bin/env bash | |
# find filename on https://go.dev/dl/ | |
GO_FILE_NAME="go1.19.3.darwin-arm64.tar.gz" | |
# usage: | |
# chmod u+x install_go.sh | |
# sudo ./install_go.sh | |
mkdir /tmp/downloads |
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
function isAnagram(s: string, t: string): boolean { | |
if (s.length !== t.length) return false | |
let counter = new Array(26).fill(0); | |
for (let i = 0; i < s.length; i++) { | |
counter[s.charCodeAt(i) - 'a'.charCodeAt(0)]++ | |
counter[t.charCodeAt(i) - 'a'.charCodeAt(0)]-- | |
} | |
return !counter.some(i => i < 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
def max_depth(s): | |
arr = [0] | |
for char in s: | |
if char == "(": | |
arr.append(arr[-1] + 1) | |
if char == ")": | |
arr.append(arr[-1] - 1) | |
return max(arr) | |
s = "( ((X)) (((Y))) )" |
Problem: You want to maintain multiple different versions of python and keep packages separated based on projects that you're working on.
Solution: Use the pyenv, virtualenv tools along with the pyenv-virutalenv plugin to manage multiple versions of python and seamlessly integrate them with your projects' virtual environments.