Sponsored
Use these hints if you're stuck. Try solving on your own first.
The constraints are small enough for a backtrack solution but not any backtrack solution
If we use a naive n^k don't you think it can be optimized
Solve with full IDE support and test cases