Minimum Operations Required (2025 Intern)

Problem Overview

  • Given item prices and multiple targets, compute the minimum operations to make all prices equal to each target, where one operation increments or decrements any price by 1.
  • Input: int[] price, int[] query; Output: int[] with minimum operations per query.
  • Each query is independent and starts from the original prices.
  • Set in a HackerLand shop; a coding interview problem and interview question.
  • Asked in IBM interviews (2025 Intern).

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: