October 2026 Archives

Benchmarking Finishing Order

Two Approaches

This blog post was inspired by the Task 1 of Weekly Challenge 396. Let’s start with the actual wording of the task:

You are given two arrays of integers, @order and @friends.
The @order (size n) contains every integer from 1 to n exactly once. The @friends contains IDs sorted in strictly increasing order.
Write a script to return the array containing IDs in finishing order.

Not clear? Let’s look at an example:

About E. Choroba

user-pic I blog about Perl.