Recall that multi-solution oracle with solutions is just a product of the single-solution oracles:

To implement Grover search for multiple solutions, we will just plop this new multi-solution oracle into the original circuit for a single Grover step:

Let's start by coding up this new oracle. Create an oracle for a random solution set of a given size using the MultiControlledX gate. Remember that this takes a string for control_values (e.g.,"11011") as a parameter rather than a list of bits.

or to submit your code

To interact with codercises, please switch to a larger screen size.

Learning Objectives:

  • Describe the geometry of Grover search for multiple solutions.
  • Compute the scaling of Grover search for multiple solutions.