Comments 1
There are tons of similar poorly explained solutions for various challenges on LeetCode. Why should this one be on Habr? A Habr article requires more details, such as:
Images to visualize the challenge and the algorithm.
Descriptions for every algorithm step. For example, the code for finding primes doesn't even mention Sieve of Eratosthenes.
Why the complexity is what it is.
No unclear abbreviations in the code.
Alternative approaches.
I solved this challenge today during the contest, but I can't understand how your code works.
+6
Only those users with full accounts are able to leave comments. Log in, please.
LeetCode, Hard++ (Acceptance 24%, Latest): 2867. Count Valid Paths in a Tree. DFS. O(n). Swift