<jupyter_start><jupyter_text>1. Two sum (Easy)Given an array of integers nums and an integer `target`, return indices of the two numbers such that they add up to `target`.You may assume that each input would have exactly one solution, and you may not use the same element twice.You can return the answer in any order.**Example 1**:     Input:    `nums = [2,7,11,15], target = 9`     Output:    `[0,1]`    Output:    `Because nums[0] + nums[1] == 9, we return [0, 1]`     **Example 2**:     Input:    `nums = [3,2,4], target = 6`     Output:      `[1,2]`   **Example 3**:     Input:      `nums = [3,3], target = 6`     Output:      `[0,1]`**Constraints**:- `2 <= nums.length <= 105`- `-10^9 <= nums[i] <= 109`  - `-10^9 <= target <= 109`- Only one valid answer exists.<jupyter_code># Solution Runtime: 48 ms, < 84.4%

def twoSum(nums, target):
    enum_arr = {}
    for index, num in enumerate(nums):
        if target - num in enum_arr:
            return [enum_arr[target - num], index]
        enum_arr[num] = index

# Test cases
cases = [
        ([2,7,11,15], 9),
        ([3,2,4], 6),
        ([3,3], 6)
        ]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16463414634146342, 'fraction_numerical': 0.05574912891986063, 'mean_word_length': 2.7549019607843137, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '248006', 'license': 'MIT', 'n_tokens_mistral': 439, 'n_tokens_neox': 400, 'n_words': 136, 'path': 'leetcode/easy.0001.two-sum.ipynb', 'repo_name': 'oleng/solved', 'size': '1148'}