3 ms·
Interviewer: sort this file of 1,000 names. Here's a Linux laptop. Candidate 1: writes some Python code Candidate 2: writes some C++ Candidate 3: runs "sort
by bluedino 10y ago
Interviewer: sort this file of 1,000 names. Here's a Linux laptop.
Candidate 1: writes some Python code
Candidate 2: writes some C++
Candidate 3: runs "sort names.txt"
- wcarron 10y agoI'm pretty new to the industry, being young, but as soon as I got a machine to run a Linux VM on, I spent hours reading docs and man pages and books on Bash and general *nix commands. Definitely helped me become a better programmer. It's amazing what you can do with simple POSIX commands. I didn't even know about sort until now, but it'll help me a bunch now.
- fiddlerwoaroof 10y agoRun `info coreutils` and get a general sense of the tools available. There are things you'll use all the time like sort, uniq and wc. Things you'll use occasionally (`foo | column -s $'\t' -t` reads all the lines of standard input, splits each on a tab and then lines everything up in nice columns) and things you might rarely need, but when you need them they're amazing: tsort, for example, is really useful for managing dependencies in certain circumstances.
- bootload 10y agoCandidates ask no questions?
- fiddlerwoaroof 10y agoAlthough, it'd be fairly simple to do this in python: python3 -c 'import sys; list(print(line.strip()) for line in sorted(sys.stdin, key=str.lower))'