Eric's Sequence

Asked at Codeium · Coding Questions · Difficulty: Hard

Eric has a sequence of non-negative integers `p[0], p[1], ..., p[n-1]`, and he would like to find a sequence `a[0], a[1], ..., a[n-1]` of `n` distinct integers such that:

Loading the problem…