Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const out = document.getElementById('out');
- const arr = [1, 4, 2, 5];
- function sovle(arr) {
- const sum = arr.reduce((v, i) => v + i);
- precondition:
- if(sum % 2 === 1) {
- if(arr % 2 === 0) {
- return null;
- }
- for(let i = 0; i < arr.length; ++i) {
- if(arr[i] % 2 === 1) {
- arr.splice(i, 1);
- break precondition;
- }
- }
- return null;
- }
- const halfSum = sum / 2;
- const left = [];
- const right = [];
- for(let i = 0; i < arr.length; ++i) {
- for(let j = 0; j < arr.length; ++j) {
- if(i === j) {
- continue;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement