Skip to content

Latest commit

 

History

History
20 lines (18 loc) · 569 Bytes

week1.md

File metadata and controls

20 lines (18 loc) · 569 Bytes

第一周

  • twoSum

      func twoSum(nums []int, target int) []int {
          var result = make([]int, 2)
          length := len(nums)
          if length > 1 {
              for i := 0; i < length-1; i++ {
                  for j := i+1; j < length; j++ {
                      if target == nums[i] + nums[j] {
                          result[0] = i
                          result[1] = j
                          return result
                      }
                  }
              }
          }
    
          return result
      }