You are viewing a single comment's thread. Return to all comments →
I folllowed your approoach and simplified it to
int st=(n-1)/2, en=n/2; st = st-k+1; en = en+k-1;
Just choose alternate elements in this range for set1
put the remaining elments in set2
calculate sum
Seems like cookies are disabled on this browser, please enable them to open this website
Fair Cut
You are viewing a single comment's thread. Return to all comments →
I folllowed your approoach and simplified it to
int st=(n-1)/2, en=n/2; st = st-k+1; en = en+k-1;
Just choose alternate elements in this range for set1
put the remaining elments in set2
calculate sum