Calculating the cost for second case
int case2 = costs [ src - 1 , rem - 1 ] + mincost ( idx + 1 , src , dest , costs ) + mincost ( idx + 1 , dest , src , costs ) + costs [ rem - 1 , dest - 1 ] + mincost ( idx + 1 , src , dest , costs ) ;