Mon Mar 10 2025 02:18:45 GMT+0000 (Coordinated Universal Time)
Saved by @IA11
const sameNumbers = (arr1, arr2) => { if (arr1.length !== arr2.length) return false; for (let i = 0; i < arr1.length; i++) { let correctIndex = arr2.indexOf(arr1[i] ** 2); if (correctIndex === -1) { return false; } arr2.splice(correctIndex, 1); } return true; };
Copy this HTML code:
Preview:
open_in_newInstructions on embedding in Medium
Comments