Number of tuples, given the relative order??

Revision en1, by fake_id_123, 2021-01-24 16:31:26

Given an array which is also an permutation.
How many tuples are there such that

$$$ i < j < k < l$$$ and $$$ a_i < a_k < a_j < a_l $$$

Another variation was

$$$ i < j < k < l < m $$$ and $$$ a_i < a_k < a_j < a_m < a_l $$$

P.S., this was interview question so no constraints were given, what is best complexity can we achieve.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English fake_id_123 2021-01-24 16:31:26 400 Initial revision (published)