6 lines
357 B
JavaScript
6 lines
357 B
JavaScript
var min = 0;
|
|
var input = require("fs").readFileSync("input.txt").toString().replace(/\r/g, "");
|
|
var ranges = input.split("\n").filter((a)=>(a)).map((line)=>(line.split("-").map((num)=>(parseInt(num))))).sort((a, b)=>(a[0] - b[0]));
|
|
var min = ranges.reduce((min, range)=>((min >= range[0]) && (min <= range[1]) ? (range[1] + 1) : min), 0);
|
|
console.log(min);
|