FastPrepRun-Length Integer Map: Get and Set
Problems/Run-Length Integer Map: Get and Set

Run-Length Integer Map: Get and Set

Adobe logoAdobe● HardFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Adobe online assessment for full-time roles. The report gives the compressed run form and asks for a faster get and a correct set. Our version puts both follow-ups in one batch of operations and returns the final encoding. Neighbouring runs with equal values must merge. We added clear size limits, so the storage requirement still matters. Our version is about 96% the same as the reported question.

A map has indices 0 through numValues-1, initially all equal to initialVal. Store it as a vector of runs [stop,value], where stop is exclusive. The first run starts at zero; each later run starts at the previous stop.

Process rows [0,index,value] to set one index and rows [1,index,value] to get one index (the third entry is ignored for get). Implement get efficiently on the ordered runs and update only the affected run when setting a value. Do not allocate storage proportional to numValues.

Return an integer matrix. Its first row contains all get results in order, and its remaining rows are the final runs in increasing stop order. For this exercise, always merge adjacent runs with the same value. Every run must be nonempty, and the final stop must be numValues.

Function

runRleMap(numValues: int, initialVal: int, operations: int[][]) → int[][]

Examples

Example 1

numValues = 5initialVal = 0operations = [[0,2,7],[1,2,0],[1,3,0],[0,3,7]]return = [[7,0],[2,0],[4,7],[5,0]]

Setting index 2 creates a one-position run with value 7. The two gets return 7 and 0. Setting index 3 to 7 joins the equal neighboring values into [2,4). The final stops are 2, 4 and 5.

Example 2

numValues = 2initialVal = 4operations = [[0,0,9],[0,1,9],[1,1,0]]return = [[9],[2,9]]

Both positions become 9, so they merge into a single run ending at 2. The get of index 1 returns 9.

Constraints

  • For this exercise, assume 1 <= numValues <= 1000000000.
  • For this exercise, assume 0 <= operations.length <= 1000.
  • Every operation has exactly three integers [opcode,index,value].
  • For this exercise, assume -1000000000 <= initialVal <= 1000000000 and -1000000000 <= value <= 1000000000.
  • Each opcode is 0 or 1, and each index is at least 0 and less than numValues.

Source note: Original OA task images and any included source example. The practice contract follows the rules stated in the problem and source note.

More Adobe Online Assessment questions

  • Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
  • Top-Funded Villages and ProjectsOA · Seen Aug 2026
  • Count Parent Nodes With a Target SumOA · Seen Aug 2026
  • Largest Binary Number by ConcatenationOA · Seen Aug 2026
  • Count Events by CategoryOA · Seen Aug 2026
  • Graph M-ColoringOA · Seen Aug 2026
  • Hall of Shifting TilesOA · Seen Aug 2026
  • K-th Ancestor Subtree Preorder QueryOA · Seen Aug 2026
  • Maze ReachabilityOA · Seen Aug 2026
  • Minimum Numeric Code TransformationOA · Seen Aug 2026

Similar questions at other companies

  • My Calendar IUber · ONSITE INTERVIEWUber interview questions
  • Maximum Interactive Team SizeMicrosoft · OAMicrosoft interview questions
  • Maximum Team SizeExpedia · OAExpedia interview questions
  • Employee Ratings Management SystemAmazon · PHONE SCREEN
  • Running Medians and PercentilesStackAdapt · PHONE SCREENStackAdapt interview questions
  • Range ModuleWalmart · PHONE SCREENWalmart interview questions
  • Dynamic First and Last Position in Sorted DataBloomberg LP · PHONE SCREENBloomberg LP interview questions
  • Running Interval Union LengthGoogle · ONSITE INTERVIEWGoogle interview questions
  • Future-Effective Employee SalaryRippling · ONSITE INTERVIEWRippling interview questions
  • Versioned ArrayTrueFoundry · PHONE SCREEN

Adobe interview experiences

  • Adobe Web, QA, DevOps, ML Roles: 13 Experiences (Part 3 of 3)
  • Adobe SWE Interviews, Level Unknown: 25 Experiences (Part 2 of 3)
  • Adobe Interviews, Level Unknown: 38 Experiences (Part 1 of 3)
  • Adobe New Grad MTS Interview Questions: 7 Experiences
  • Adobe ML/Research Intern Interviews: 12 Experiences (Part 4 of 4)
  • Adobe Product Intern Interviews: 15 Experiences (Part 3 of 4)
All Adobe interview questionsSee Adobe hiring insights
Saved
class Solution {
    public int[][] runRleMap(int numValues, int initialVal, int[][] operations) {
        // Write your solution here.
    }

}
Checking account…