Please help me with this dp problem

I did this problem and it got accepted too but can you help me with a better approach or with proper and effective steps to follow to reduce my runtime.

Code-https://ide.codingblocks.com/s/356268
Problem Link-https://www.lintcode.com/problem/paint-house/description

Hey @mridulmohanbagri17, You are using the inner loop which is redundant and there is no need of new DP array and we can modify the array that is provided itself.

Have a look at it!
And ask me if you have any queries :blush:
Happy Coding!