jce200 - Overview
🏂
“Continuous improvement is better than delayed perfection.”
- Amsterdam
- https://www.monastic.nl
Highlights
Pinned Loading
-
Check whether array A is a permutation. Check whether array A is a permutation.
1
function solution(A) {2
let N = A.length;
3
if (N === new Set(A).size) {4
let summ = (N * (N + 1)) / 2;
5
let aSumm = A.reduce((a, b) => a + b);
-
react-spotify react-spotify Public
Forked from Arts-Archives/react-spotify
a react app connected to the spotify web api
CSS
-
PermMissingElem PermMissingElem
1
// Find the missing element in a given permutation.
2
3
// An array A consisting of N different integers is given.
4
// The array contains integers in the range [1..(N + 1)], which means that exactly one element is missing.
5
-
Minimize the value |(A[0] + ... + A[... Minimize the value |(A[0] + ... + A[P-1]) - (A[P] + ... + A[N-1])|.
1
function solution(A) {2
let min = Infinity;
3
const total = A.reduce((a, b) => a + b);
4
5
let left = 0;
