FastPrepDeep Merge with a Conflict Resolver
Problems/Deep Merge with a Conflict Resolver

Deep Merge with a Conflict Resolver

Autodesk logoAutodesk● MediumFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report names deep object merge with a provided conflict function and links the canonical exercise. The flattened runner adapter preserves that task at about 95%.

Two nested objects are given as lists of their leaves. Each leaf is a string path=value, where path is one or more keys joined by dots (like user.age) and value is an integer. Inside one object, no path appears twice. No path is a prefix of another path, so a and a.b never both appear.

Merge first and second deeply. A path that appears in only one object keeps its value. When a path appears in both, combine the first value and the second value with resolver:

  • SUM: add them.
  • MAX: take the larger one.
  • MIN: take the smaller one.
  • SECOND: take the value from second.

Return every merged leaf as path=value, sorted by path in dictionary order (by character codes).

Function

deepMerge(first: String[], second: String[], resolver: String) → String[]

Examples

Example 1

first = ["user.age=30","user.score=5","version=1"]second = ["user.score=7","user.name=2","version=3"]resolver = "SUM"return = ["user.age=30","user.name=2","user.score=12","version=4"]

user.age is only in first, so it stays 30. user.name is only in second, so it stays 2. user.score is in both, so SUM gives 5 + 7 = 12. version is in both, so SUM gives 1 + 3 = 4. Sorted by path, the answer is ["user.age=30","user.name=2","user.score=12","version=4"].

Example 2

first = ["a.b=-2","z=4"]second = ["a.b=5","m=8"]resolver = "MIN"return = ["a.b=-2","m=8","z=4"]

a.b is in both lists, and MIN of -2 and 5 is -2. z and m each appear once and keep their values. Sorted by path: a.b, m, z.

Constraints

  • 0 ≤ first.length, second.length ≤ 100000
  • Each path has 1 to 200 characters: ASCII letters, digits, underscores and dots. Keys between the dots are not empty.
  • Across both lists, no path is a prefix (key by key) of a different path.
  • Each value is a signed 32-bit integer, and every SUM result fits in a signed 64-bit integer.
  • resolver is SUM, MAX, MIN or SECOND.

More Autodesk interview questions

  • Non-Repeating CharacterONSITE INTERVIEW · Seen Nov 2026
  • Remove Trailing ZerosONSITE INTERVIEW · Seen Nov 2026
  • Reverse Linked ListONSITE INTERVIEW · Seen Nov 2026
  • LRU Cache with TTLONSITE INTERVIEW · Seen Oct 2026
  • Diagonal Bounce TraversalOA · Seen Oct 2026
  • Interleave Array HalvesOA · Seen Oct 2026
  • Latest Arrival to Catch a BusOA · Seen Oct 2026
  • Find Top Two TeamsOA · Seen Sep 2026
  • In-Memory Database with TTLOA · Seen Mar 2026

Similar questions at other companies

  • Insert an Employee into an Organization HierarchyWaymo · PHONE SCREENWaymo interview questions
  • Rank Word-Translation Hints from Sentence TranslationsDuolingo · PHONE SCREEN · ONSITE INTERVIEWDuolingo interview questions
  • Group AnagramsAmazon Web Services · ONSITE INTERVIEWAmazon Web Services interview questions
  • Query Log MatchDatadog · PHONE SCREEN · ONSITE INTERVIEWDatadog interview questions
  • Response Time Stats by URL PatternGusto · ONSITE INTERVIEWGusto interview questions
  • Longest Consecutive Login StreakAmazon · ONSITE INTERVIEW
  • Transform Dotted Keys into a Nested MapProofpoint · ONSITE INTERVIEW
  • Serialize and Deserialize a String Key-Value StoreByteDance · ONSITE INTERVIEWByteDance interview questions
  • Group AnagramsMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Find Duplicate Element PairsGoogle · ONSITE INTERVIEWGoogle interview questions

Autodesk interview experiences

  • Autodesk SDE Intern OA and Interviews: 5 Experiences
All Autodesk interview questionsSee Autodesk hiring insights
Saved
class Solution {
    public String[] deepMerge(String[] first, String[] second, String resolver) {
        // Write your code here.
    }
}
Checking account…