Data Structures & AlgorithmsModerateICPC regional · complexity theory

Problem: Which of the following problems is NP-complete (decision version)?

  1. A. Does a graph contain an Euler circuit?
  2. B. Does a graph contain a Hamiltonian cycle?
  3. C. Is there a path of length at most k between two vertices?
  4. D. Is a given array sorted?

Correct answer: B. Does a graph contain a Hamiltonian cycle?

Hamiltonian cycle is one of Karp's 21 NP-complete problems. Euler circuits are decidable in linear time by checking degrees and connectivity, and the other two are polynomial.

More Coding Interview Problems questions

Exams that ask this topic