0% found this document useful (0 votes)
32 views1 page

Array Coding Questions

Uploaded by

Aniket Ganguli
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views1 page

Array Coding Questions

Uploaded by

Aniket Ganguli
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Q1.

Lost Luggage Tracker

At a major international airport, luggage scanning systems handle thousands of bags daily,
assigning IDs from 1 to n. Recently, a software malfunction caused one bag to be scanned twice
while another was completely missed, causing confusion amongst baggage handlers and delays for
travelers. To avoid missing luggage or duplicates during transfer, the airport authorities need an
automated system to quickly analyze the scanned luggage IDs and reliably report which bag ID is
missing and which one is duplicated. This system ensures baggage claim is expedited and
improves passenger service. Constraints: 1 <= n <= 10^5 Topic: Missing & Duplicate Element
Expected Time Complexity: O(n) Expected Space Complexity: O(1) Sample Input: [1, 2, 2, 4]
Sample Output: Missing = 3, Duplicate = 2 Explanation: Bag ID 2 is repeated, and ID 3 is missing.

Q2. Missing Number Finder

A software system manages user IDs numbered sequentially from 1 to n. Due to a database error
during migration, one ID has gone missing, causing inconsistencies in user lookup and access
controls. To maintain system integrity, administrators require a method to identify the missing user
ID efficiently without sorting or scanning the entire dataset multiple times. Accurate detection
ensures system reliability, prevents unauthorized access issues, and allows for prompt restoration
of complete user records. Constraints: 1 <= n <= 10^6 Topic: Missing Number Expected Time
Complexity: O(n) Expected Space Complexity: O(1) Sample Input: [1, 2, 4, 5] Sample Output: 3
Explanation: The sequence should be 1 to 5, but 3 is missing.

You might also like