原创 Lowest Common Ancestor of a Binary Tree -- leetcode

Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definiti

原创 Ugly Number -- leetcode

Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime fac

原创 Lowest Common Ancestor of a Binary Search Tree -- leetcode

Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to

原创 Different Ways to Add Parentheses -- leetcode

Given a string of numbers and operators, return all possible results from computing all the different possible ways t

原创 Integer to English Words -- leetcode

Convert a non-negative integer to its english words representation. Given input is guaranteed to be less than 231 - 1

原创 Number of Digit One -- leetcode

Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.

原创 Add Digits -- leetcode

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

原创 Ugly Number II -- leetcode

Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime factors only include 2,

原创 Delete Node in a Linked List -- leetcode

Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed

原创 Palindrome Linked List -- leetcode

Given a singly linked list, determine if it is a palindrome. Follow up: Could you do it in O(n) time and O(1) space?

原创 Search a 2D Matrix II -- leetcode

Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:

原创 Single Number III -- leetcode

Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exa

原创 Missing Number -- leetcode

Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array

原创 H-Index -- leetcode

Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute th

原创 Binary Tree Paths -- leetcode

Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: 1 / \ 2