Two Sum

 1 public class Solution {
 2     public int[] twoSum(int[] numbers, int target) {
 3         // Start typing your Java solution below
 4         // DO NOT write main() function
 5         int result[] = new int[2];
 6         int tags = 0;
 7         for (int i = 0; i < numbers.length && tags == 0; i++)
 8             for (int j = i + 1; j < numbers.length && tags == 0; j++)
 9             {
10                 if (numbers[i] + numbers[j] == target)
11                 {
12                     result[0] = i + 1;
13                     result[1] = j + 1;
14                     tags = 1;
15                 }
16             }
17         return result;
18     }
19 }

吐槽:为什么Accepted之后,仍然显示0/132? 而且代码不保存记录?

 

posted on 2013-07-01 10:28  leiatpku  阅读(156)  评论(0编辑  收藏  举报