Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Use a divide and conquer strategy.
The first number will always be the root. Consider the numbers smaller and larger than the root separately. When merging the results together, how many ways can you order x elements in x+y positions?