1. You are given a fence with n posts and each post can be painted with one of them k colours 2. You have to paint all the posts in a way such that no more than two adjacent fence posts have the same color 3. Return all possible ways of painting the posts 4. Input and output is handled for you 5. It is a functional problem ,please do not modify main()
Input Format
Input is handled for you
Output Format
Output is handled for you
Constraints
n and k are positive integers
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
8 3
Output
3672