|
|
|
|
|
by yolo69420
1511 days ago
|
|
Maybe I'm missing something but unless the interviewer expects a 100% correct csv parser that handles all possible corner cases this is basically - read file - start at beginning; if you encounter separator, add new entry to an array. if you encounter newline, save entire current array as a new line to an array of lines. - do lexicographical sort of arrays (can just use qsort for this). - if the test q actually wants you to parse out numbers and shit like that, nothing about the structure changes, you just have to record some extra info when parsing values and then use a different comparison depending on the type in the function you pass to qsort I dare say someone programming algorithms in a kernel or writing code for custom file systems should be able to do this. OK 15 min may be tight if you're nervous but you should get there. |
|