def polarize(probs):
    """ Helper function to compute polar code probabilities for channels with probabilities probs. """
    result = []
    for p in probs:
        result.append(p ** 2)
        result.append(2 * p - p ** 2)
    return result