Problem 3343 · Hard

Count Number of Balanced Permutations

Choose which digits sit at even positions with a DP over count and sum, weighting each choice by inverse factorials.

Open the interactive visualisation