⌘K
Flycodx

Flipkart Paint Warehouse Houses

Flipkart Paint Warehouse Houses

EasyDynamic Programming100% accepted

Flipkart has n warehouses to paint with 3 colors (red, blue, green). No two adjacent warehouses can have the same color. Cost matrix cost[i][j] = cost to paint house i with color j. Find minimum total cost.

Approach

Paint n houses with 3 colors, no two adjacent same color, minimum cost.

Input

3 17 2 17 16 16 5 14 3 19

Output

10
solution.py
Loading editor...
Test 1
Test 2
Test 3

Press Run to test your custom input, or Submit to judge against all test cases.

Sign in to continue

Create a free account to run code, submit solutions and track progress.

  • Free forever — no credit card
  • 10+ languages with live execution
  • Points, streaks & leaderboards
Auto Save OnLn 1, Col 1Spaces: 4UTF-8LFPython 3