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]
];
#coding #computer-science #development #javascript #programming