GOOGLE SDE Phone Screening Round | 1 Question

Anonymous User
4048
Jan 18, 2025
Jan 18, 2025

Given an array of integers, select K elements such that product is maximized. Return product.

Did a sorting based approach - but missed some cases where all the numbers were negative, followup was

  1. No extra space after sorting
  2. No sorting - suggested Priority queues.

How would u do it?

Comments (16)