摘要:
70. Climbing Stairs You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many dist 阅读全文
摘要:
53. Maximum Subarray Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the a 阅读全文
摘要:
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 阅读全文
摘要:
326. Power of Three Given an integer, write a function to determine if it is a power of three. Follow up: Could you do it without using any loop / rec 阅读全文
摘要:
405. Convert a Number to Hexadecimal Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method 阅读全文
摘要:
415. Add Strings Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2. Note: 思路:控制num1的长度不小于num2的长度,在n 阅读全文
摘要:
108. Convert Sorted Array to Binary Search Tree 思路:利用一个有序数组构建一个平衡二叉排序树。直接递归构建,取中间的元素为根节点,然后分别构建左子树和右子树。 阅读全文
摘要:
501. Find Mode in Binary Search Tree Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred element) in 阅读全文
摘要:
Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example, Given nums = [0, 1, 阅读全文
摘要:
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 j equals 阅读全文