def build_prefix_array(pattern):
    """
    Returns a list of numbers (indexes) of the location where the given pattern from the text was found.
    Similar to the built-in string (`str`) function `find`), it'll return -1 when no match has found.
    :param text:
    :param pattern:
    :return: [int]
    """
    # building the prefix array
    pattern_length = len(pattern)
    prefix_array = [0] * pattern_length
    j = 0

    for i in range(1, pattern_length):
        if pattern[j] == pattern[i]:
            prefix_array[i] = j + 1
            j += 1
        else:
            j = prefix_array[j - 1]
            prefix_array[i] = j
            continue

        i += 1

    return prefix_array