Biggest Single Number II

ASKED IN INTERVIEW
4pts
Apple

Problem Statement

You are given a table containing a list of integers. Some numbers are repeated. Your goal is to find the second largest number among those that appear only once in the table.

Rules:

  • A number must have a frequency of exactly 1 to be considered.
  • From that set of unique numbers, return the second highest value.
  • If there is no second largest number (e.g., only 0 or 1 unique numbers exist), return NULL.
  • Output column: second_biggest.
Tests your understanding of
Subqueries, Grouping and Offset

Input Tables

MyNumbers
num(INTEGER)
8
8
7
3
1
4
4
5
Number_Metadata
num(INTEGER)source(VARCHAR)
8Batch A
7Batch B
Audit_Logs
log_id(INTEGER)num(INTEGER)entry_time(TIMESTAMP)
10182026-02-09 10:00:00

Expected Output

second_biggest(INTEGER)
5

Tags

MediumASKED IN INTERVIEWSubqueriesGroupingOffset
15-20 min
52%

Hints