K Smallest Squared Values in a Sorted Array

K Smallest Squared Values in a Sorted Array

Given a nondecreasing sorted integer array nums and an integer k, return the smallest k values among the squares of all elements in nums, in non...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: