We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e50e48e commit 187a224Copy full SHA for 187a224
Solutions/0001_Two Sum.java
@@ -0,0 +1,24 @@
1
+class Solution
2
+{
3
+ public int[] twoSum(int[] nums, int target)
4
+ {
5
+ int[] result = new int[2];
6
+ boolean flag=false;
7
+ for(int i=0;i<nums.length;i++)
8
9
+ for(int j=i;j<nums.length;j++)
10
11
+ if(i!=j&&nums[i]+nums[j]==target)
12
13
+ result[0]=i;
14
+ result[1]=j;
15
+ flag=true;
16
+ break;
17
+ }
18
19
+ if(flag)
20
21
22
+ return result;
23
24
+}
0 commit comments