Tag: c++
In this problem, a tree is an undirected graph that is connected and has no cycles. The given input is a graph that started as a tree with N …
Given a binary tree root, remove all nodes with only one child. Constraints n ≤ 100,000 where n is the number of nodes in root Example 1 Input root …
Given a list of integers nums and an integer k, return whether there are four distinct elements in the list that add up to k. Constraints n ≤ 100 …
Given a directed graph represented as an adjacency list, return its reverse so if an edge goes from A to B, it now goes from B to A. Each …
Given a positive integer n, return whether n can be written as the sum of distinct positive factorial numbers. Example 1 Input n = 31 Output true Explanation Since …