Find duplicate rows
Your task
A feature store keeps a very wide table in sparse form. Entry k records that row row_ids[k], column col_ids[k] holds values[k]. Rows are numbered 0 to row_count minus 1, every entry names a row in that range, and no row and column pair is listed twice. Every cell that is not listed holds zero, and a listed cell is allowed to hold zero as well, which means exactly the same thing as not listing it at all. Column numbers reach into the billions, so the dense table is never built. Two rows are duplicates when every column holds the same value in both. Return the ascending list of rows that no other row duplicates. Return an empty list when row_count is 0.
Examples
unique_feature_rows(row_count: int, row_ids: list[int], col_ids: list[int], values: list[int]) -> list[int]Example 1
Input
unique_feature_rows(3, [0, 1, 2], [5, 5, 7], [4, 4, 4])Output
[2]Example 2
Input
unique_feature_rows(2, [0], [9], [0])Output
[]Example 3
Input
unique_feature_rows(3, [0, 0, 1, 1, 2], [7, 2, 2, 7, 7], [1, 9, 9, 1, 1])Output
[2]