Implement Prototype(source map[string][]int,patches []Patch) (map[string][]int,error) with an explicit deep copy, then Solve with the same ownership contract. Each Patch replaces one existing key's element at Index with Value. Keys may be empty. Reject unknown keys or indices outside the key's slice, returning nil and nonnil error. Repeated patches apply in order; nil source with no patches yields a nonnil empty map. Preserve the original map, all nested slices and patches on success/error. Returned nested slices must neither alias input nor one another, even when two input keys shared storage. Final O(total stored elements + patches) time. Empty nested results are nonnil.

Edit exercise.go; retain the public types and signatures. prototype and final are separate stages. The executable tests recover panics as failures, report named checks, and exit nonzero on any failure. A successful run must execute at least one check. Tests use logical time or explicit synchronization where relevant.

Drag or use the arrow keys to resize. Home collapses the question; End collapses the editor. Enter or double-click resets the split.
Loading editor…
No results yet.

Complete the starter code, then run the checks.
Results and errors will appear here.