NewThe Learning module is now liveSee what's new

You are given root, the non-null root node of an in-memory filesystem tree. Each node is either a directory or a file.

Your task is to traverse the entire filesystem tree, scan the text lines stored in every file node, and extract all valid IPv4 addresses. Return the unique IPv4 addresses sorted in lexicographic order.

Each node is defined as:

class Node {
    String name;
    boolean isFile;
    List<String> lines;
    List<Node> children;
}
Stdout
-