We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 318f367 commit 7c44056Copy full SHA for 7c44056
library/trees/uncommon/count_paths_per_length.hpp
@@ -9,7 +9,7 @@
9
//! which are each O(n)
10
vector<ll> count_paths_per_length(const vector<vi>& adj) {
11
vector<ll> num_paths(sz(adj));
12
- num_paths[1] = sz(adj) - 1;
+ if (sz(adj) >= 2) num_paths[1] = sz(adj) - 1;
13
edge_cd(adj,
14
[&](const vector<vi>& cd_adj, int cent, int split) {
15
vector<vector<double>> cnt(2, vector<double>(1));
0 commit comments