I am not been able to understand this video hint can you please help me understanding in proper way
I am not been able tounderstand this video hint can you please help me understanding in proper way
hello @manikjindal49
try to think recursively.
solve(i,sum_so_far) =( pick first shoes and solve(i+1,sum_so_far+value of first shoe)
or
pick second shoes and solve(i+1,sum_so_far+value of second shoe)
return sum of both the cases.
base case ->
if i==n -> if sum_so_far is even return 0 otherwise return 1.
refer this ->
Still i am not able to understand can you please make it somewhat easy like explainnation to understand this roblem
bro think of brute force solution first.
for every pair of shoe u have two options .
either u will pick left one or u will right one.
and then u will proceed to next pair of shoes and repeat the same process again .
now try to frame recurrence relation based on above logic