#3533

Concatenated Divisibility

international master · 1975 · lc hard +32 · 30.6% accepted · 48 likes · top 8%

Description

Given positive integer array nums and integer k, find the lexicographically smallest permutation of nums such that concatenating the elements in that order yields a number divisible by k.

Return that permutation, or an empty list if none exists.

Code

1
2
3