Created
January 11, 2021 09:21
-
-
Save pitsanujiw/f110cfae24a654b96d891120298a521b to your computer and use it in GitHub Desktop.
This file contains 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
public class Solution { | |
public int[] TwoSum(int[] nums, int target) { | |
for (int i = 0; i < nums.Length; i++) { | |
for (int j = i + 1; j < nums.Length; j++) { | |
if (nums[j] == target - nums[i]) { | |
return new int[] { i, j }; | |
} | |
} | |
} | |
return new int[0]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment