Member-only story

BQN Chicken Roll-Ups

Dunya Kirkali
2 min readFeb 28, 2022

So you’ve managed to solve the first TryAPL problem and are ready to tackle the next one?

Let’s get cookin’

Making The Grade

The second problem from 2013 is titled: Making The Grade

The problem is asking us to write a function which returns the percent of passing grades in an array of grades.

The naive approach

We’ll have to split this problem into two parts. Firstly we’ll have to filter the grades that are passing (above 65) and then we can try to calculate the percentage of them.

Luckily when we have a function (eg. ≤) BQN can automatically apply it on a array.

65≤25‿90‿100‿64‿65

Will return

⟨ 0 1 1 0 1 ⟩

This is a quite standard pattern in Array Programming Languages where you first apply a function which will help one create a mask to filter out the items one needs.

In this problem, we do not need to get the items but we need to find the percentage of 1's over the whole length of the array.

The naive approach would be to literally do that where we could count the number of 1’s simply by summing the array we just obtained

+´65≤25‿90‿100‿64‿65

Dunya Kirkali
Dunya Kirkali

Written by Dunya Kirkali

I'm an engineering manager passionate about empowering engineers to deliver exceptional work through collaboration and innovation.

No responses yet

Write a response