Function to find the minimized sum
function MinimizeleftOverSum ( a , n ) { var v1 = [ ] , v2 = [ ] ; for ( i = 0 ; i < n ; i ++ ) { if ( a [ i ] % 2 == 1 ) v1 . push ( a [ i ] ) ; else v2 . push ( a [ i ] ) ; }