Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function minPlatform(arr, dep) {
- let obj = new Object();
- let plat = 0;
- let result = 0;
- for (let i = 0; i < arr.length; i++) {
- obj[arr[i]] = "a";
- obj[dep[i]] = "d";
- }
- for (let i of Object.keys(obj)) {
- if (obj[i] == "a") {
- plat++;
- } else {
- plat--;
- }
- if (plat > result) {
- result = plat;
- }
- }
- return result;
- }
- minPlatform(
- [900, 940, 950, 1100, 1500, 1800],
- [910, 1200, 1120, 1130, 1900, 2000]
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement