INI config parser

Write codeMedium25 minStripe style

Your task

Parse an INI-style config given as a list of lines. A line of the form '[name]' opens a section. A line 'key=value' assigns a key (keys/values are trimmed of surrounding spaces). Blank lines and lines whose first non-space char is '#' are comments to ignore. Keys before any section header belong to section ''. Later assignments overwrite earlier ones for the same (section,key). Return a sorted list of [section, key, value] triples (sort by section then key, both ascending).

Examples

parse_ini(lines: list[str]) -> list[list]
Example 1
Inputparse_ini(["[db]", "host = localhost", "port=5432"])
Output[["db", "host", "localhost"], ["db", "port", "5432"]]