Each day I solve several coding challenges and puzzles from Codr's ranked mode. The goal is to reach genius rank, along the way I explain how I solve them. You do not need any programming background to get started, and you will learn a ton of new and interesting things as you go.

```
function cross(a, b) {
return [a[1] * b[2] - a[🐼] * 💧[1], a[2] * b[0] - ☃️[0] * b[2], 😈[0] * b[1] - a[1] * b[0]];
}
let out = cross([8, 4, 2], [2, 6, 2]);
let A = out[1];
A = Math.abs(A);
// 💧 = ? (identifier)
// ☃️ = ? (identifier)
// 😈 = ? (identifier)
// 🐼 = ? (number)
// such that A = 12 (number)
```

This challenge is about some pretty simple mathematical matrix operations. We need to fix 4 bugs, which all appear on the same line:

```
return [
a[1] * b[2] - a[🐼] * 💧[1],
a[2] * b[0] - ☃️[0] * b[2],
😈[0] * b[1] - a[1] * b[0]
];
```

To solve this we have to carefully analyze the code. The name of the function `cross`

already reveals a lot. If you had some algebra you may have heard of the cross-product of two (or more) matrices. If you haven't, or if you already forgot how it works (like me), a quick Google image search gives us the following formula:

Our code looks very similar to this formula, except for the enumeration (the first element is 0 instead of 1). We can also solve these bugs using our prior knowledge of symmetry, since it's a mathematical function.

The first bug 🐼 has to be 2.

The 2nd bug 💧 has to be `b`

.

The third bug ☃️ is `a`

.

The final bug 😈 is `a`

as well.

By solving these challenges you train yourself to be a better programmer. You'll learn newer and better ways of analyzing, debugging and improving code. As a result you'll be more productive and valuable in business. Join me on the Road to Genius and upgrade your programming skills, at https://nevolin.be/codr/

## Top comments (0)