Lowest number missed in an array
Given an array A of N integers, returns the smallest positive integer (greater than 0) that does not occur in A
HTML
<div id="result1"></div>
JavaScript
function solution(a) {
tempArray.sort(function(a,b){return a-b});
tempArray = tempArray.filter(function(c){return Math.min(c)})
return tempArray;
}
var input1 = [4,2,5,1];
document.getElementById('result1').innerHTML = solution(input1);