Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target. E......

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 given sum. F......

Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the dept......

Given a non-empty binary search tree and a target value, find the value in the BST that is closest to the target. Note: Given target value is a floati......

Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical a......

Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). For ......

Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: 1 / \ 2 3 \ 5 All root-to-leaf paths are: ["1->2-......

Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... Note: n is positive and will fit within the range of a 32-b......

The set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of the numbers in the set got duplicated to another n......

Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any positive intege......

Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is like:......

You have a total of n coins that you want to form in a staircase shape, where every k-th row must have exactly k coins. Given n, find the total number......

Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z......

Given an integer, write a function to determine if it is a power of two. class Solution { public boolean isPowerOfTwo(int n) { if(n == 0) return false......

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. For exa......

We define the Perfect Number is a positive integer that is equal to the sum of all its positive divisors except itself. Now, given an integer n, write......

Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity. 这道题最好用数学解法，如果末尾为0，那么必然2*......

Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding column number. For example: A ......

Given a non-negative integer c, your task is to decide whether there're two integers a and b such that a2 + b2 = c. Example 1: Input: 5 Output: True E......

Given an m * n matrix M initialized with all 0's and several update operations. Operations are represented by a 2D array, and each operation is repres......