Tag: depth first search
Given a nested list of integers, return the sum of all integers in the list weighted by their depth. Each element is either an integer, or a list — …
An image is represented by a 2-D array of integers, each integer representing the pixel value of the image (from 0 to 65535). Given a coordinate (sr, sc) representing …
In a binary tree, the root node is at depth 0, and children of each depth k node are at depth k+1. Two nodes of a binary tree are …
A binary tree is univalued if every node in the tree has the same value. Return true if and only if the given tree is univalued. A binary tree …
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words. For example, given …