摘要:
Problem: Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. 阅读全文
摘要:
Problem: Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child 阅读全文
摘要:
Problem: You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizo 阅读全文
摘要:
Problem: Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those lett 阅读全文
摘要:
Problem: Find the sum of all left leaves in a given binary tree. Summary: 求左子叶之和。 Analysis: 1. 求左子叶之和,即需要遍历整棵二叉树,常规的方法则为递归。首先我想到的是调用子函数,在子函数中递归,每递归至一个 阅读全文
摘要:
Problem: Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) such that the distance between iand 阅读全文
摘要:
Problem: Given a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a move is increm 阅读全文
摘要:
Problem: Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the giv 阅读全文
摘要:
Problem: You are given a binary tree in which each node contains an integer value. Find the number of paths that sum to a given value. The path does n 阅读全文
摘要:
Problem: Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5 阅读全文