FastPrepArray Challenge (QR Intern)
Problems/Array Challenge (QR Intern)

Array Challenge (QR Intern)

Akuna Capital logoAkuna Capital● EasyINTERNOA

Updated Aug 2026

QuestionFunctionExamplesConstraints

Problem statement

You are given an integer array arr.

For each element arr[i]:

  1. Initialize a counter to 0.
  2. Compare arr[i] with every element arr[j] to its left, where j < i.
    • If arr[j] > arr[i], subtract |arr[i] - arr[j]| from the counter.
    • If arr[j] < arr[i], add |arr[i] - arr[j]| to the counter.
    • If the two values are equal, the counter does not change.

Return a new array containing the final counter value for each element.

Function

arrayChallenge(arr: int[]) → int[]

Examples

Example 1

arr = [2,4,3]return = [0,2,0]
  • For arr[0] = 2, there are no elements to the left, so the counter is 0.
  • For arr[1] = 4, add |4 - 2| = 2, so the counter is 2.
  • For arr[2] = 3, first compare with 4: 0 - |3 - 4| = -1. Then compare with 2: -1 + |3 - 2| = 0.

Therefore, return [0, 2, 0].

Constraints

  • 1 <= arr.length <= 10^5.

More Akuna Capital Online Assessment questions

  • Delivery Management SystemOA · Seen Nov 2026
  • Count Server ReplacementsOA · Seen Nov 2026
  • Match Orders by Price and Arrival TimeOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Maximum Remaining Drone PowerOA · Seen Nov 2026
  • Rolling MetricsOA · Seen Oct 2026
  • Vowel Substring GameOA · Seen Sep 2026
  • Competitive ForagingOA · Seen Sep 2026
  • Binary CircuitOA · Seen Sep 2026
  • Items SortOA · Seen Sep 2026
  • Minimize Malware Spread by Removing a NodeOA · Seen Sep 2026

Similar questions at other companies

  • Online No-Intercept Linear RegressionTwo Sigma · OATwo Sigma interview questions
  • Prefix Scores With the Running MaximumC3.ai · OAC3.ai interview questions
  • Basic Item DiscountsPalantir · OAPalantir interview questions
  • Diagonal Bounce TraversalAutodesk · OAAutodesk interview questions
  • Costliest ChocolateRippling · OARippling interview questions
  • Plus Mult ArrayIBM · OAIBM interview questions
  • Progressive Tax CalculatorInteractive Brokers · OA
  • 2020 Account Balance with Monthly Card FeesDRW · OADRW interview questions
  • Range Negation UpdatesJP Morgan Chase · OAJP Morgan Chase interview questions
  • Latency Bucket CounterDatadog · OA · PHONE SCREENDatadog interview questions

Akuna Capital interview experiences

  • Akuna Capital Quant Trader and QR Interviews: 5 Experiences
  • Akuna Capital JQR CodePair Rounds: 8 Experiences (Part 6 of 6)
  • Akuna Capital QR Probability Phones: 14 Experiences (Part 5 of 6)
  • Akuna Capital QR-ML Interviews: 11 Experiences (Part 4 of 6)
  • Akuna Capital QR Regression Rounds: 11 Experiences (Part 3 of 6)
  • Akuna Capital QR Coding Interviews: 17 Experiences (Part 2 of 6)
All Akuna Capital interview questionsSee Akuna Capital hiring insights
Saved
class Solution {
    public int[] arrayChallenge(int[] arr) {
      // write your code here
    }

}
Checking account…