sudo apt update && sudo apt install git && /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" && echo >> ~/.bashrc && echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv bash)"' >> ~/.bashrc && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv bash)" && sudo apt-get install build-essential && brew install gcc btopclass Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: for idx1, val1 in enumerate(nums): for idx2, val2 in enumerate(nums): if idx1 == idx2: continue if val1 + val2 == target: return [idx1, idx2]class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]:
# map for complementing elements: complementary-idx complementing_map = {}
for idx, val in enumerate(nums): if val in complementing_map: return [complementing_map[val], idx] complementing_map[target - val] = idx