DTW (Dynamic Time Warping) is a widely used algorithm for finding similarity metric between two time-series (T1 and T2). The idea of this algorithm is to utilize dynamic programming to figure out the most optimal alignment path (i.e. a path that minimizes the overall distance cost if we have to travel from beginning to the end of both time-series(s) while comparing them), which is constructed under some constraints.
This demonstration gives a basic idea of how this path is constructed. The original distance value is usually interpreted as the cumulative cost present at i=N, J=M, where N is the size of T1 and M is the size of T2. A very intuitive visible observation is: As the path is constructed, it avoids the traps with higher cost (red-ish).