From 1e50d169295886c2c137d0e54554cc64756683fe Mon Sep 17 00:00:00 2001 From: Akshay Date: Wed, 4 Feb 2026 23:44:26 -0500 Subject: [PATCH] SUbmitting Mock Q --- Problem1.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Problem1.java b/Problem1.java index e69de29b..c1da9dec 100644 --- a/Problem1.java +++ b/Problem1.java @@ -0,0 +1,22 @@ +class Solution { + //T.C : O(n) n : nums.length + //S.C: O(n) + + public int[] twoSum(int[] nums, int target) { + HashMap map = new HashMap<>(); + + + + + for(int i = 0; i< nums.length; i++){ + if(map.containsKey(target - nums[i])){ + return new int[] {i, map.get(target - nums[i])}; + + } + + map.put(nums[i], i); + + } + return new int[] {}; + } +} \ No newline at end of file