Skip to content

Instantly share code, notes, and snippets.

@pitsanujiw
Created January 11, 2021 09:21
Show Gist options
  • Save pitsanujiw/f110cfae24a654b96d891120298a521b to your computer and use it in GitHub Desktop.
Save pitsanujiw/f110cfae24a654b96d891120298a521b to your computer and use it in GitHub Desktop.
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