Get Max Discount Pairs

Problem Overview

  • Count pairs (i, j) with i < j where price[i] + price[j] is a power of three.
  • Input: array of n product prices (integers); Output: integer count of qualifying pairs.
  • Context: Amazon Prime Day offer rewards pairs whose sum hits a power of three with a 50% discount.
  • Source: Asked in Amazon interviews; a coding interview problem often used as an interview question.

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: