Interview question from Spectra for weighted dice problem