Guest User

Untitled

a guest
May 28th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. class Solution {
  2. public int[] twoSum(int[] nums, int target) {
  3. for(int i=0;i<nums.length;i++)
  4. {
  5. for(int j=i+1;j<nums.length;j++)
  6. {
  7. if(target==nums[i]+nums[j]){
  8. return new int[] {i,j};}
  9. }
  10. }
  11.  
  12. throw new IllegalArgumentException("No two sum solution");
  13.  
  14. }
  15. }
Add Comment
Please, Sign In to add comment