Paint Fence
Medium
Counting & Combinatorics
A fence has n posts to be painted with k colours so that no more than two adjacent posts have the same colour. Print the number of ways.
Constraints
1 <= n <= 50 1 <= k <= 10^5
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.