Difference Calculator (Akuna Shang Hai )

Problem Overview

  • Task: Given an integer array, compute two run-based indicators and return their absolute difference.
  • Indicator 1: count runs where value k repeats exactly k times; Indicator 2: count 1-based indices k where from index k, k repeats exactly k times.
  • Input: n and arr (1 ≤ N ≤ 100, 1 ≤ arr[i] ≤ 15); Output: single integer difference.
  • Context: Array/sequence pattern detection problem used in coding interview settings.
  • Company: Asked in Akuna interviews (Akuna Shanghai) 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: