This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution { | |
int[] ans, count; | |
List<Set<Integer>> graph; | |
int N; | |
public int[] sumOfDistancesInTree(int N, int[][] edges) { | |
this.N = N; | |
graph = new ArrayList<Set<Integer>>(); | |
ans = new int[N]; | |
count = new int[N]; | |
Arrays.fill(count, 1); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require("fs"); | |
const path = require("path"); | |
const walk = require("walk"); | |
const PROJECT_PATH = path.resolve(path.dirname(__dirname), 'src'), | |
checkRegExp = new RegExp("(^\\@[^@\\(]+\\()", "m"), | |
filesCountToSkip = 0; // Some magic number of files which aren't related to the Angular at all | |
let totalTSFiles = 0, | |
angular2TSFiles = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* ES6 implementation of flatten function. | |
* It's sorter due to syntax sugar but usually consume more memory due to larger amount of function calls. | |
*/ | |
function flatten(arr) { | |
return arr.reduce( | |
(a, b) => a.concat(Array.isArray(b) ? flatten(b) : b), [] | |
); | |
} |