if elements are similar so for making a pair we toggle any of them . Since toggle cost is 1 so overall weight gain becomes 3
else { ans = Math . max ( 3 + getMaxRec ( str , i + 2 , n , lookup ) , ans ) ; } }