Engineering With Java

Engineering With Java

Spring Boot Interview Question: Batch Normalization API

Normalization, Performance, CPU bound, Code samples and more.

Suraj Mishra's avatar
Suraj Mishra
Feb 11, 2026
βˆ™ Paid

Scenario

You are building a data analytics service that receives numeric metrics from various clients and normalizes them into a fixed range before further processing.

This service will expose a REST API that accepts a batch of numeric values and returns the normalized results.

Problem Statement

  1. Create a Spring Boot REST API with a POST endpoint /normalize.

  2. The endpoint should accept a JSON payload:

{
  "values": [50, 75, 120, -10],
  "targetMin": 0,
  "targetMax": 1
}

The API should return the normalized values as a JSON array:

[0.5, 0.875, 1.0, 0.0]

The API should handle edge cases:

  • Empty arrays

  • All identical values (map to middle of target range)

  • Inverted target ranges (e.g., [1,0])


πŸ“’ Get actionable Java/Spring Boot insights every week β€” from practical code tips to real-world use-case based interview questions.

Join 5000+ subscribers and level up your Spring & backend skills with hand-crafted content β€” no fluff.

First 100 paid subscribers will get the annual membership at $50/year ( 60 already converted to paid, 40 remaining )

So far we have covered 44+ real world based interview questions and will add up to 100 by end of this year.

Not convinced? Check out the details of the past work


Solution

From the problem statement , it feels like we need to focus on 3 things:

  • Data modeling – defining the input and output.

  • Normalization logic – how we actually compute normalized values.

  • Exposing the API – building a Spring Boot endpoint for clients.

Data modeling

For the request, we should define a DTO with:

  • An array of doubles, values

  • targetMin and targetMax

This keeps the API flexible, since clients can normalize into any range they want.

User's avatar

Continue reading this post for free, courtesy of Suraj Mishra.

Or purchase a paid subscription.
Β© 2026 Suraj Mishra Β· Privacy βˆ™ Terms βˆ™ Collection notice
Start your SubstackGet the app
Substack is the home for great culture