Tap here to switch tabs
Problem
Submissions

Problem: Concatenated Divisibility

med
30 min
Try to solve the Concatenated Divisibility problem.

Statement

Given an integer array nums and an integer k, find the lexicographically smallest permutation of nums such that the number formed by concatenating the elements in that order is divisible by k.

Return the lexicographically smallest permutation as an array of integers. If no permutation produces a concatenated number divisible by k, return an empty array.

Constraints:

  • 1≤1 \leq nums.length ≤13\leq 13

  • 1≤1 \leq nums[i] ≤105\leq 10^5

  • 1≤1 \leq k ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Concatenated Divisibility

med
30 min
Try to solve the Concatenated Divisibility problem.

Statement

Given an integer array nums and an integer k, find the lexicographically smallest permutation of nums such that the number formed by concatenating the elements in that order is divisible by k.

Return the lexicographically smallest permutation as an array of integers. If no permutation produces a concatenated number divisible by k, return an empty array.

Constraints:

  • 1≤1 \leq nums.length ≤13\leq 13

  • 1≤1 \leq nums[i] ≤105\leq 10^5

  • 1≤1 \leq k ≤100\leq 100