Discuss / Java / 求和

求和

Topic source

Andylbc

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

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

int sum = 0;

for(Integer n : list){

sum += n;

}

        return (start + end) * (end -start +1)/2 - sum;

    }


  • 1

Reply