postcredit
Vacancies · 0
No vacancies were found for the selected period.
Interviews · 1
Other direction
Technical
By interview stage
- Technical1
By grade
- Senior1
Questions and tasks · 5
Other direction
Tell about your experience.
What will happen if the sorting is removed? What will break the algorithm?
Why does the algorithm compare the concatenations AB and BA, rather than just the numbers A and B directly?
[ 99, 3, 88, 10, 23, 96, 11 ] [ 11, 2 ] function largestNumber(array $nums) { usort($nums, function($a, $b) { $ab = (string) $a . (string) $b; $ba = (string) $b . (string) $a; return strcmp($ba, $ab); }); return implode('', $nums) === str_repeat('0', count($nums)) ? '0' : implode('', $nums); } $result = largestNumber([ 99, 3, 88, 10, 23, 96, 11 ]);
Tell about your work experience.