Code
Diff
  • var getMin = function (list){
      var list = (!list) ? 0 : list.filter(function(v){ return (v > 0 && v < Number.MAX_VALUE); });
      return Math.min.apply(null,list) | 0;
    }
  • 11 var getMin = function (list){
    2 var min = Number.MAX_VALUE;
    3 for (var i = 0; i < list.length; i++) {
    4 if (+list[i] <= 0) {
    5 continue;
    6 }
    7 min = Math.min(min, +list[i]);
    8 }
    9 return min = min === Number.MAX_VALUE ? 0 : min;
    2+ var list = (!list) ? 0 : list.filter(function(v){ return (v > 0 && v < Number.MAX_VALUE); });
    3+ return Math.min.apply(null,list) | 0;
    1010 }