2018-10-10 22:03:03 +00:00
---
id: 5900f3841000cf542c50fe97
challengeType: 5
title: 'Problem 24: Lexicographic permutations'
2019-08-28 13:26:13 +00:00
forumTopicId: 301885
2018-10-10 22:03:03 +00:00
localeTitle: 'Задача 24: Лексикографические перестановки'
---
## Description
2019-08-28 13:26:13 +00:00
< section id = 'description' >
Перестановка - упорядоченная компоновка объектов. Например, 3124 является одной из возможных перестановок цифр 1, 2, 3 и 4. Если все перестановки перечислены численно или в алфавитном порядке, мы называем это лексикографическим порядком. Лексикографические перестановки 0, 1 и 2: < div style = "text-align: center;" > 012 021 102 120 201 210 < / div > Что такое < var > n-< / var > я лексикографическая перестановка цифр 0, 1, 2, 3, 4, 5, 6, 7, 8 и 9?
< / section >
2018-10-10 22:03:03 +00:00
## Instructions
2019-08-28 13:26:13 +00:00
< section id = 'instructions' >
2018-10-10 22:03:03 +00:00
< / section >
## Tests
< section id = 'tests' >
```yml
tests:
2019-08-28 13:26:13 +00:00
- text: < code > lexicographicPermutations(699999)</ code > should return 1938246570.
testString: assert(lexicographicPermutations(699999) == 1938246570);
- text: < code > lexicographicPermutations(899999)</ code > should return 2536987410.
testString: assert(lexicographicPermutations(899999) == 2536987410);
- text: < code > lexicographicPermutations(900000)</ code > should return 2537014689.
testString: assert(lexicographicPermutations(900000) == 2537014689);
- text: < code > lexicographicPermutations(999999)</ code > should return 2783915460.
testString: assert(lexicographicPermutations(999999) == 2783915460);
2018-10-10 22:03:03 +00:00
```
< / section >
## Challenge Seed
< section id = 'challengeSeed' >
< div id = 'js-seed' >
```js
function lexicographicPermutations(n) {
// Good luck!
return n;
}
lexicographicPermutations(999999);
```
< / div >
< / section >
## Solution
< section id = 'solution' >
```js
// solution required
```
2019-08-28 13:26:13 +00:00
2018-10-10 22:03:03 +00:00
< / section >