← Questions

Squares of a sorted array, then the k smallest squares

0
UberCodingLast asked Sep 2026

A coding interview question asked in Uber's coding round, last asked Sep 2026. It tests arrays, two pointers and binary-search.

You get an integer array nums sorted in non-decreasing order, which may contain negative numbers, and an integer k. Return the k smallest values among the squares of the elements, in non-decreasing order.

Sign in to unlock this question

The full prompt, the worked answer and your own canvas or code with the AI tutor. New accounts get 5 credits: each one unlocks a question for good.

Where it's asked

  • Uber · Coding · Last asked Sep 202660 min · Two rounds; one is often object-oriented design (a parking lot, a meeting scheduler, an expression evaluator) · No AI, except a newer AI-assisted debugging round in some senior loops

What it tests

arrays · two pointers · binary-search

Your code and the AI tutor open when you unlock this question.