Discuss / Java / 取巧

取巧

Topic source

OooMiyaOoo

#1 Created at ... [Delete] [Delete and Lock User]

static int findMissingNumber(int start, int end, List<Integer> list) {

int total = ((end+start)*(end-start + 1))/2;

int max = 0;

for(Integer p : list)

max+= p.intValue();

return total - max;

}

和你写的一毛一样^-^


  • 1

Reply