Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(ar) {
- function sum(c) {
- return typeof c === 'number' ? ar.reduce((sum, ar) => sum + ar[c], 0) : c.reduce((sum, e) => sum + e, 0);
- }
- for (let i = 0; i < ar.length - 1; i++)
- if (sum(ar[i]) !== sum(ar[i + 1]) || sum(i) !== sum(i + 1))
- return false;
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment