PAYTM PAYMENTS BANK | Off Campus OA (2024) | Find All Lonely Numbers in the Array Problem
Paytm · Question · Posted Jun 2026
Problem Statement Given an integer array nums, a number is considered lonely if: It appears exactly once in the array. Neither num - 1 nor num + 1 exists in the array. Return all lonely numbers present in the array. Example 1 Input nums = [10,6,5,8] Output [10,8] Explanation 10 appears once and neither 9 nor 11 exists. 8 appears once and neither 7 nor 9 exists. 6 is not lonely because 5 exists. 5 is not lonely because 6 ...
The full answer & interview discussion are available to premium members.
Log in Create a free account