Search
⌘K

Leetcode 977. Squares of a Sorted Array

Given a non-decreasing integer array (which may contain negatives), return the squares of each number in non-decreasing order; the core challenge is to produce this in O(n) time by leveraging the input order (e.g., merging largest squares from both ends) instead of re-sorting.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.