Array Challenge (QR Intern)

Problem Overview

  • For each array element, compute a counter by comparing it to all elements on its left: add the absolute difference if the left value is smaller, subtract if larger; return the counters.
  • Input: int array arr[n]; Output: int[n] counters; constraints not specified.
  • Domain: array processing and comparative scoring in data analysis contexts.
  • Source: Akuna interviews; a common coding interview problem and 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: