Java implementation to find the number of ways to paint K cells of 3 x N grid such that No two adjacent cells are painted
import java . util . * ; class GFG { static int mod = ( int ) ( 1e9 + 7 ) ; static final int MAX = 301 ; static final int MAXP = 3 ; static final int MAXK = 600 ; static final int MAXPREV = 4 ; static int [ ] [ ] [ ] [ ] dp = new int [ MAX ] [ MAXP + 1 ] [ MAXK ] [ MAXPREV + 1 ] ;