Chick population decreases by 2 / 3 everyday . For 8 th day on [ i - 6 ] i . e 2 nd day population was 3 and so 2 new born die on the 6 th day and so on for the upcoming days
dp [ i ] = ( dp [ i - 1 ] - ( 2 * parseInt ( dp [ i - 6 ] / 3 , 10 ) ) ) * 3 ; } return dp [ n ] ; }