Integer Map Using a Vector
Updated
Problem statement
Implement an integer map backed by a vector or array. Its valid indices are 0 through numValues-1, and every index initially maps to initialVal.
Process operations in order. Each row has three integers:
[0,index,value]: set the value at that index.[1,index,value]: get the value at that index; the third entry is ignored.
Return the get results in their operation order. A set produces no output.
Function
runIntMap(numValues: int, initialVal: int, operations: int[][]) → int[]Examples
Example 1
numValues = 3initialVal = 7operations = [[1,0,0],[0,1,9],[1,1,0],[1,2,0]]return = [7,9,7]The first get reads the initial value 7. Setting index 1 to 9 affects only that index. The last two gets therefore return 9 and 7.
Example 2
numValues = 1initialVal = -2operations = [[0,0,5],[0,0,-8],[1,0,0]]return = [-8]The second set replaces the first value at index 0, so the get returns -8.
Constraints
- For this exercise, assume 1 <= numValues <= 1000000.
- For this exercise, assume 0 <= operations.length <= 100000.
- Each operation contains exactly three integers [opcode,index,value].
- For this exercise, assume -1000000000 <= initialVal <= 1000000000 and -1000000000 <= value <= 1000000000.
- Every opcode is 0 or 1, and every index satisfies 0 <= index < 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
- Base Unit ConversionsOA · Seen Nov 2026
- 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
Similar questions at other companies
- Bank Accounts with Balance HistoryMeta · OAMeta interview questions
- Process Banking OperationsVercel · OA
- Memory AllocatorTikTok · OATikTok interview questions
- Adding Stack 2.0IMC Trading · OAIMC Trading interview questions
- Parcel Attribute Store with TTLAirbnb · OAAirbnb interview questions
- Random Dasher Set OperationsDoorDash · ONSITE INTERVIEWDoorDash interview questions
- Constant-Time Weighted Pick with an Alias TableEtched · PHONE SCREEN
- Billing Log with Undo and RedoReddit · PHONE SCREENReddit interview questions
- Path Leaf Character IteratorGoogle · ONSITE INTERVIEWGoogle interview questions
- Process On-Call Routing OperationsOpenAI · PHONE SCREENOpenAI interview questions
Adobe interview experiences
- Adobe New Grad OA: Unit Conversion and Code Review: 1 Experience
- 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)