mirror of
https://github.com/devenperez/leetcode.git
synced 2026-06-13 23:07:08 +00:00
Time: 171 ms (69.80%), Space: 43.9 MB (56.52%) - LeetHub
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user