LeetCode Çözümleri – 448. Find All Numbers Disappeared in an Array

LeetCode içerisinde bulunan “Find All Numbers Disappeared in an Array” sorusunun açıklaması ve çözümü. Bu soruda size [1, n] aralığındaki sayıları içerebilen bir tam sayı dizisinde, [1, n] aralığında olup ta bu dizide olmayan sayıları geriye döndürmeniz isteniyor.

► LeetCode 228. 448. Find All Numbers Disappeared in an Array: https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/

► Problem açıklaması:

Given an array nums of n integers where nums[i] is in the range [1, n], return an array of all the integers in the range [1, n] that do not appear in nums.

Example 1:

Input: nums = [4,3,2,7,8,2,3,1]

Output: [5,6]

Example 2:

Input: nums = [1,1]

Output: [2]

Constraints:

n == nums.length

1 <= n <= 10^5

1 <= nums[i] <= n

Follow up: Could you do it without extra space and in O(n) runtime? You may assume the returned list does not count as extra space.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.