Pergunta de entrevista da empresa MSCI

Given an array, print all possible indices combinations that can be added to form a given sum.