mirror of
https://github.com/devenperez/leetcode.git
synced 2026-06-13 23:07:08 +00:00
12 lines
345 B
C#
12 lines
345 B
C#
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[i] + nums[j] == target) {
|
|
return new int[] {i , j};
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
} |