From 96b0d0648a95beddde12b9845c5d0b8e33e663e9 Mon Sep 17 00:00:00 2001 From: Deven <63876261+devenperez@users.noreply.github.com> Date: Sun, 22 Jan 2023 19:12:36 -0500 Subject: [PATCH] Time: 171 ms (69.80%), Space: 43.9 MB (56.52%) - LeetHub --- 1-two-sum/1-two-sum.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 1-two-sum/1-two-sum.cs diff --git a/1-two-sum/1-two-sum.cs b/1-two-sum/1-two-sum.cs new file mode 100644 index 0000000..b31efae --- /dev/null +++ b/1-two-sum/1-two-sum.cs @@ -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; + } +} \ No newline at end of file