package leetcode;

import java.util.Arrays;
import java.util.List;

/**
 * https://leetcode.com/problems/exclusive-time-of-functions/
 */
public class Problem636 {
    public int[] exclusiveTime(int n, List<String> logs) {
        int[] result = new int[n];
        // TODO
        return result;
    }

    public static void main(String[] args) {
        Problem636 prob = new Problem636();
        System.out.println(prob.exclusiveTime(2, Arrays.asList(
            "0:start:0",
            "1:start:2",
            "1:end:5",
            "0:end:6"
        ))); // [3, 4]
    }
}

@@ -59,16 +59,40 @@
 il.List;
+%0Aimport java.util.Stack;
 %0A%0A/**%0A *
@@ -287,15 +287,531 @@
     
-// TODO
+Stack%3CInteger%3E%5B%5D stack = new Stack%5Bn%5D;%0A        for (String log : logs) %7B%0A            String%5B%5D split = log.split(%22:%22);%0A            int id = Integer.parseInt(split%5B0%5D);%0A            String type = split%5B1%5D;%0A            int time = Integer.parseInt(split%5B2%5D);%0A            if (stack%5Bid%5D == null) %7B%0A                stack%5Bid%5D = new Stack%3C%3E();%0A            %7D%0A            if (type.equals(%22start%22)) %7B%0A                stack%5Bid%5D.add(time);%0A            %7D else %7B%0A                result%5Bid%5D += time - stack%5Bid%5D.pop();%0A            %7D%0A        %7D
 %0A   
@@ -953,16 +953,32 @@
 println(
+Arrays.toString(
 prob.exc
@@ -1101,24 +1101,24 @@
 :end:6%22%0A
-
         
 ))); // 
@@ -1109,16 +1109,17 @@
         
+)
 ))); // 

Update problem 636