Data Structures & AlgorithmsVery hardICPC regional · combinatorics

Problem: What does the Erdos-Szekeres theorem state?

  1. A. Every graph has a Hamiltonian path
  2. B. Every prime has a primitive root
  3. C. Every tree is bipartite
  4. D. Any sequence of n^2 + 1 distinct numbers has an increasing or decreasing subsequence of length n + 1

Correct answer: D. Any sequence of n^2 + 1 distinct numbers has an increasing or decreasing subsequence of length n + 1

Pigeonhole on the longest increasing subsequence ending at each position gives the monotone subsequence bound.

More Coding Interview Problems questions

Exams that ask this topic