Pregunta de entrevista de Walmart Global Tech

Not remember exactly but based on bitmask, implementation and dynamic programming