This question evaluates skills in string parsing and content-based grouping for duplicate file detection, along with matrix manipulation for image operations like horizontal flips and box blur, covering competencies in algorithm design, data-structure selection, and numerical array transformations.
You are given a list of directory records. Each record is a string describing a directory path followed by one or more files in that directory, where each file is described as name(content).
Example record:
"root/a 1.txt(abcd) 2.txt(efgh)"
Return all groups of duplicate files, where two files are duplicates if they have exactly the same content. Each group should contain the full paths of all files that share that content (only include groups with at least 2 files).
paths
: an array of strings, each formatted as:
dir file1(content1) file2(content2) ...
"root/a/1.txt"
.
1 <= paths.length <= 2*10^4
You are given a grayscale image represented as a 2D matrix img of integers (e.g., 0..255).
Implement the following operations:
img
:
H x W
integer matrix
["FLIP", "BLUR"]
) indicating the order to apply operations.
1 <= H, W <= 2000