**Implement Painting Fence Algorithm.** [https://www.geeksforgeeks.org/painting-fence-algorithm/](url)