Finding rainbow cycle in digraph colored with $\log n$ colors
The idea is to use dynamic programming. For each vertex $v$ and color subset $S$, calculate whether there is a simple path, ending at $v$, and including exactly the colors in $S$. Details left to you.

The main trick here is that we can be sure that the path being constructed is simple since all vertices in it have different colors. We can apply the same idea to uncolored graphs by choosing a random coloring. This is known as color-coding, an idea of Alon, Yuster and Zwick with wide applicability.