Find All Lonely Numbers in an Integer Array

Problem: Find All Lonely Numbers in an Integer Array

Given an integer array nums, a number x is called a lonely number if neither x - 1 nor x + 1 appears in the array.

Return all lone...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: