text: 
  /*
  给定 nums = [2, 7, 11, 15], target = 9
  
  因为 nums[0] + nums[1] = 2 + 7 = 9
  所以返回[0, 1] */
  
  /**
   * 题目介绍：https://leetcode-cn.com/problems/two-sum/
   * @param {number[]} nums
   * @param {number} target
   * @return {number[]}
   */
  const twoSum = function (nums, target) {
      let map = {};
  
      for (let i = 0; i < nums.length; i++) {
          let complement = target - nums[i];
          if (map[complement] !== undefined) {
              return [map[complement], i];
          }
          map[nums[i]] = i;
      }
      return [];
  };
  // 解法二：暴力双重循环
  /* var twoSum = function (nums, target) {
  
      for (let i = 0; i < nums.length; i++) {
          for (let j = i + 1; j < nums.length; j++) {
              if ((nums[i] + nums[j] === target)) {
                  return [i, j];
              }
          }
      }
  }; */
  
  module.exports = twoSum;