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

0% completed

Vote For New Content
Daehan Choi
Another but simple solution (not in a cyclic sort fashion)

Daehan Choi

Aug 19, 2024

public static int findMissingNumber(int[] nums) { boolean[] checks = new boolean[nums.length + 1]; for (int num: nums) { checks[num] = true; } for (int i = 0; i < checks.length; i++) { if (!checks[i]) return i; } return -1; }

0

0

Comments
Comments

On this page