PMMockr

QuestionsTechnical PMTop-Interview

Given a sorted array of integers (which may include negatives), return the squares of the numbers in sorted order. As a follow-up, find the k-th smallest squared value.

Focus on developing an efficient algorithm to square the integers in the sorted array and maintain the sorted order of the results. Consider the properties of the input array, particularly how negative numbers will affect the squaring process. Discuss the two-pointer technique as a potential solution to merge the squares from both ends of the array towards the center. For the follow-up question, outline how you would efficiently find the k-th smallest squared value, possibly leveraging the sorted nature of the squared results. Be prepared to explain your time and space complexity for both parts of the question.

What this question tests

Practise this question under interview conditions. Answer it out loud against a timer with an AI interviewer that asks follow-ups, then review the scored report.

Start a timed mock interview

Related Technical PM questions

All Technical PM questions · Product manager interview questions by skill area