Omid - Challenge 52

data-challenges
advanced-exercises
🔰 Find Missing Numbers!
Published

March 24, 2026

Illustration for Omid - Challenge 52

Challenge Description

🔰 Find Missing Numbers!

Solutions

library(tidyverse)
library(readxl)

input = read_excel("files/CH-052 Find missing Numbers.xlsx", range = "B2:B15")
test  = read_excel("files/CH-052 Find missing Numbers.xlsx", range = "J2:J7")

full_s = full_seq(c(min(input$Input), max(input$Input)), 1)
missing = setdiff(full_s, input$Input)

identical(missing, test$`Missing Numbers`) 
# [1] TRUE
  • Logic:

    • Reads the workbook ranges needed for the challenge
  • Strengths:

    • The R solution stays close to the workbook rule and keeps the transformation compact.
  • Areas for Improvement:

    • The code assumes the sheet structure and source ranges remain stable.
  • Gem:

    • The strongest part of the solution is choosing the right intermediate representation before shaping the final output.
import pandas as pd

input = pd.read_excel("CH-052 Find missing Numbers.xlsx",  usecols="B", skiprows=1)
test = pd.read_excel("CH-052 Find missing Numbers.xlsx",  usecols="J", skiprows=1, nrows = 5)

missing = list(set(range(min(input["Input"]), max(input["Input"]) + 1)) - set(input["Input"]))

print(missing == test["Missing Numbers"].tolist()) # True
  • Logic:

    • Reads the workbook ranges needed for the challenge
  • Strengths:

    • The Python version follows the same rule in a direct dataframe-oriented implementation.
  • Areas for Improvement:

    • The code assumes the workbook layout remains stable, so any sheet redesign would require small adjustments.
  • Gem:

    • The implementation stays close to the original workbook rule instead of adding unnecessary abstraction.

Difficulty Level

This task is moderate:

  • The business rule is readable, but the workbook still requires careful implementation to reach the expected layout.