Facebook | Phone | Natural Sort Order
Anonymous User
2308

Recently interviewed with FB for a summer SWE internship and completely choked. I was expecting a question that was more leetcodey and my nervers kinda just blocked me from critically thinking.

How would you guys' solve this question.

Implement a natural sorting comparator.

Example:

Input: ['b', 'a', 'a1', 'a10b3', 'a2', 'aa']
Regular: ['a', 'a1', 'a10b3', 'a2', 'aa', 'b']
Natural: ['a', 'a1', 'a2', 'a10b3', 'aa', 'b']

I think my soulution was close but I could not solve it fast enough to get to the second question

Comments (8)