Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Vote For New Content
Fei Shan
O(n) 's more elegant solution

Fei Shan

Sep 23, 2024

int findMissingNumber2(int[] nums) { int total = ( 0 + nums.length ) * (nums.length + 1) / 2; int sum = Arrays.stream(nums).sum(); return total - sum; }

1

0

Comments
Comments

On this page