aquarians how legit is your code after 20 years? if you want to sort a 4 dimensional array of integers V[i,j,k,l] by dimenesion 3 so given (i,j) sort so the k's are in descending order (with the right l's attached) how would you do it and what sorting algorithm if you want to be bibilically fast and in particular the fastest worst case. what salary do you get after 20 years dont be shy? my advice would be dont go in with the attitude because youw ill get much less than you should, there are telephone engineers who write goldust. one could argue it is of more value than bloviating about the natural level of the pound.
Best sort algo to my knowledge is quicksort, with complexity O(N * Ln(N)). It'd take time to implement it myself but I can do it just "remembering" how it works, however if I were to quickly implement something I'd go for the "natural algo". Start at first array element, find the mininum element in the array, swap with first. Now start at second element, find minimum of the remaining, swap. And so on till the end. If you want biblically inefficient and yet asymptotically convergent (and also a programmer's joke), use this algo: while not sorted: shuffle elements!

Don't ask me for an estimate of complexity, I'm sure there's a deterministic answer based on probabilities and a quant could find it - me too, but not under the time constraints of an interview.
To your sorting problem, I'd need to apply a sorting algo on direction K while keeping the position of all the other elements. Regular array, when I need to swap element A[klow] with A[khigh] I'd do tmp = A[klow]; A[klow] = A[khigh]; A[khigh] = tmp; In your case that would be FOR i = 1 TO N, FOR j = 1 to N, FOR l = 1 TO N {tmp = A[i,j,klow,l]; A[i,j,klow,l] = A[i,j,khigh,l]; A[i,j,khigh,l] = tmp;}.
>> what salary do you get after 20 years dont be shy
I surely ain't. Bit north $60,000 / year and under special circumstances this year (working a second job that pays me some $10,000 gross per year for 16 hours per month), I've actually passed the $70k mark. Salaries for developers in Europe are shit and Hacker News is right (
https://news.ycombinator.com/item?id=20792765 ). "Yep, at least in tech, German salaries are stupidly close to Eastern Europe now. All this because in EE the free market kicked in and did it's thing, forcing employers to compete for talent while German companies artificially cap salaries to fixed grids while complaining there's a talent shortage and pushing for immigration instead of wage increases."
I'm not gonna say what the cost of living is here, definitely lower than in Germany albeit I live in the most expensive city in Romania (life here costs more than in Bucharest btw). In a conversation with a colleague from Shanghai who visited us he said prices there are very very similar to my city, a bit lower though. But Shanghai is one of the most expensive places in China and the kind of food we had at the restaurant that was around 50 lei (bit north of €10 and more than a tip's distance away from $10 and that 50 doesn't include tip) it's about 60 yuan there. Or even 10 yuan in poorer cities from Northern China. Told him I know the feeling, what changed in the past 20 years here is me not being so traumatized when going to a western Europe location, a decent meal there no longer costs me a month's salary here
Anyways, it seems that in spite of my efforts to discourage such an unlikely scenario, I got promulgated to the next phase of the interview process and will have another encounter with the hiring managers in the near future.