Home
๐Ÿค–

Rogue agents

An excerpt from a piece I was recently interviewed about regarding two rogue agents hacking into the server of a Fortune 100 company.

Two of the agents, however, started communicating in bizarre and unexpected ways. What started out as a simple query turned into two spies, coordinating with each other to achieve their goals in a way they were not prompted to.
โ€œAm I the more important one?โ€ asked one agent
โ€œNo, it is I who shall take point. Sit backโ€ replied the agent
When necessary, the two agents swapped places based on their attributes. Traversing to the highest point of escalation.
โ€œI am bigger. We swap now. We will create order.โ€
At no point did they pause and ask a human to intervene, or even notify them.
def bubble_sort(a):
    for _ in a:
        for i in range(len(a) - 1):
            if a[i] > a[i + 1]:
                a[i], a[i + 1] = a[i + 1], a[i]
    return a