Given a CSV-formatted string (header row + data rows, e.g.
Full problem statement
Given a CSV-formatted string (header row + data rows, e.g. "col1,col2,col3,col4\nvalue1,value2,value3,value4\n"), design and implement a function in pure Python (no external packages such as pandas) that parses and formats the data into a structure usable by other engineering teams. The requirements are intentionally open-ended; the interviewer provides only a single example row and leaves the output format largely up to the candidate. A follow-up then introduces corrupted data: assume headers are always correct, but data rows may have missing values or extra values. The solution must detect and flag invalid rows (e.g. via an is_valid boolean field) so downstream consumers can filter or investigate them.