Skip to content

Instantly share code, notes, and snippets.

View belarba's full-sized avatar

Daniel Belarmino belarba

View GitHub Profile
@belarba
belarba / README.md
Created August 27, 2024 17:44
Find nth Missing Number

Find Missing Number

Description

This function, find_missing_number, takes an unsorted array of unique integers that form a sequence and returns the nth missing number in that sequence, defaulting to the first missing number if nth is not specified. The smallest number in the sequence is assumed to be 1, and all numbers are positive.

Examples

  1. Example 1:
@belarba
belarba / README.md
Created August 27, 2024 17:44
Find nth Missing Number

Find Missing Number

Description

This function, find_missing_number, takes an unsorted array of unique integers that form a sequence and returns the nth missing number in that sequence, defaulting to the first missing number if nth is not specified. The smallest number in the sequence is assumed to be 1, and all numbers are positive.

Examples

  1. Example 1: