There are n consecutives houses in the city. You are painting n houses with k different colors. You must paint the house following these rules:
Given the two integers n and k, return the number of ways you can paint the houses.
Example:
Input: n = 3, k = 2
Output: 6
Explaination: Possible ways to paint the houses with 2 colors(0, and 1) are : 1 1 0, 1 0 1, 1 0 0, 0 1 1, 0 0 1, 0 1 0
Need help around this problem, I mean how to approach this kind of problem, is it through DP, graph, or maths?