Append Deranged CSV Rows
Problem statement
Given parsed CSV rows, append one derangement of every original row. In a derangement, every value moves to a different column from its position in that original row.
For deterministic judging, construct each deranged row by rotating its values one position to the left. Return all original rows in order, followed by their rotated rows in the same order.
Function
appendDerangedRows(rows: String[][]) → String[][]Examples
Example 1
rows = [["a","b","c"],["1","2"]]return = [["a","b","c"],["1","2"],["b","c","a"],["2","1"]]Each appended row is a left rotation, so no value stays in its original column.
Constraints
1 <= rows.length <= 1000.2 <= rows[i].length <= 100.- Values within each row are distinct strings.