Created
August 28, 2018 20:55
-
-
Save enomoto/21b2a88afcc83298e808fea628d6b779 to your computer and use it in GitHub Desktop.
Two Sum, Brute Force https://leetcode.com/problems/two-sum/
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
| class Solution: | |
| def twoSum(self, nums, target): | |
| """ | |
| :type nums: List[int] | |
| :type target: int | |
| :rtype: List[int] | |
| """ | |
| for i, num in enumerate(nums): | |
| for j, num2 in enumerate(nums): | |
| if i == j: | |
| continue | |
| if num + num2 == target: | |
| return [i, j] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment