Tag: depth first search algorithm
Given the root of a binary tree, consider all root to leaf paths: paths from the root to any leaf. (A leaf is a node with no children.) A …
The combination algorithm returns the sequence for a list or string without considering the order. For example, the Combination of string “abc” with two characters would be “ab”, “ac” …
An integer has sequential digits if and only if each digit in the number is one more than the previous digit. Return a sorted list of all the integers …
Given a 2D Grid with integer values representing the colours, you are asked (in an interview probably) to find out the maximum connected colour sizes. A colour is connected …
Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum. Note: A leaf is a node with no children. Example: …