Category: algorithms
Given a binary tree, each node has value 0 or 1. Each root-to-leaf path represents a binary number starting with the most significant bit. For example, if the path …
A valid parentheses string is either empty (“”), “(” + A + “)”, or A + B, where A and B are valid parentheses strings, and + represents string …
Given the root node of a binary search tree (BST) and a value. You need to find the node in the BST that the node’s value equals the given …
Given a non-negative integer c, your task is to decide whether there’re two integers a and b such that a^2 + b^2 = c. Example 1: Input: 5 Output: …
Given two strings A and B, find the minimum number of times A has to be repeated such that B is a substring of it. If no such solution, …