Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

[Pattern] Permutations

Правка en1, от dheetCoder, 2023-03-21 15:03:03

Suppose we have given a permutation of length n. Can we find the count of a specific binary string of length n-1. Such that for each permutation p we increment the count of binary string b, where b[i]=='1' if p[i+1]>p[i] else '0' for each i from 0...n-2. For n=5 I have runned the bruteforce code

Code

Getting the output

result
Теги pattern recognition, next_permutation

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский dheetCoder 2023-03-21 15:03:03 1217 Initial revision (published)