Safe columns to drop

Write codeHard35 minDatabricks and Snowflake style

Your task

A data team exports a table as rows of string cells, every row the same width. They want to know which single columns carry no distinguishing information. Dropping column j is safe when it merges nothing: any two rows that differ somewhere before the drop still differ somewhere after it. Rows may repeat in the export, and a repeated row was already identical to its twin, so repeats never block a drop. Cells hold arbitrary text and may contain commas, pipes, quotes or any other character, so any scheme that glues a row into a single string has to stay unambiguous. Given the table, return the indices of every safe column, sorted ascending. Return an empty list when the table has no rows or no columns.

Examples

droppable_columns(rows: list[list[str]]) -> list[int]
Example 1
Inputdroppable_columns([["a", "1", "x"], ["a", "2", "x"], ["b", "1", "x"]])
Output[2]
Example 2
Inputdroppable_columns([["a", "b"], ["a", "b"]])
Output[0, 1]
Example 3
Inputdroppable_columns([["one,two", "three"], ["one", "two,three"]])
Output[0, 1]