Approach for CHEFFA

Can someone please share your approach for CHEFFA 100 points. I tried dfs passing vectors everytime changing the elements. But it passed only for partial marks.

They have updated Editorial here…

My solution is here…

Closed the question as the discussion can go on the editorial page of the problem.

1 Like