Questions › Technical PM › Top-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.
- Technical PM
- Top-Interview
- Easy
- 10 min
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
- Technical PM
- Structured problem solving
- Communication
- Trade-off reasoning
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.
Related Technical PM questions
- Design the architecture for a hardware device that measures temperature and social distance among employees in warehouses during COVID.Top-Interview · Technical PM · Hard
- Design a language learning app for Meta.Top-Interview · Technical PM · Hard
- Design the system for a ticket selling web application.Top-Interview · Technical PM · Hard
- What is the best way to connect SQL databases and why?Top-Interview · Technical PM · Hard
- Design a rate limiter.Top-Interview · Technical PM · Hard
- Given an integer array nums and an integer k, return true if nums has a subarray of at least two elements whose sum is a multiple of k.Top-Interview · Technical PM · Hard
All Technical PM questions · Product manager interview questions by skill area