leetcode 530. Minimum Absolute Difference in BST | inorder

2017-09-22
阅读 2 分钟
1.8k
Given a binary search tree with non-negative values, find the minimum absolute difference between values of any two nodes.

leetcode 520. Detect Capital

2017-09-22
阅读 2 分钟
1.9k
Given a word, you need to judge whether the usage of capitals in it is right or not.

leetcode 506. Relative Ranks | HEAP or priority_queue

2017-09-14
阅读 3 分钟
3k
Given scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be awarded medals: "Gold Medal", "Silver Medal" and "Bronze Medal".

[前中后序遍历] 已知其中两个, 重建树

2017-09-11
阅读 1 分钟
3.1k
已知中序+后序, 重建 按照图示顺序, 从根写起, 依靠中序分割左右两侧, 逐步重建.后序较前序稍微难一点点(只不过是从右往左), 故给出这一个典型例子足矣. 已知前序+后序不足以重建 如: {代码...} 这两个树的前序和后序是一致的, 因此只知道前后序无法精确重建!

leetcode 501. Find Mode in Binary Search Tree | 二叉树遍历(递归和非递归实现)

2017-09-10
阅读 6 分钟
3.6k
Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred element) in the given BST.

leetcode 459. Repeated Substring Pattern | KMP

2017-09-06
阅读 5 分钟
3.4k
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. You may assume the given string consists of lowercase English letters only and its length will not exceed 10000.

leetcode 500. Keyboard Row

2017-09-05
阅读 2 分钟
1.8k
Given a List of words, return the words that can be typed using letters of alphabet on only one row's of American keyboard like the image below.

leetcode 496. Next Greater Element I

2017-09-05
阅读 3 分钟
2.4k
You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1's elements in the corresponding places of nums2.

leetcode 479. Largest Palindrome Product

2017-09-05
阅读 1 分钟
3k
Find the largest palindrome made from the product of two n-digit numbers.

leetcode 476. Number Complement

2017-09-04
阅读 3 分钟
1.9k
Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.

leetcode 475. Heaters

2017-09-04
阅读 3 分钟
2.1k
Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.

leetcode 448. Find All Numbers Disappeared in an Array

2017-09-04
阅读 1 分钟
1.4k
Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.

leetcode 438. Find All Anagrams in a String

2017-09-02
阅读 3 分钟
2.1k
Given a string s and a non-empty string p, find all the start indices of p's anagrams in s.

leetcode 437. Path Sum III | 递归!!

2017-09-02
阅读 3 分钟
3.9k
You are given a binary tree in which each node contains an integer value.

leetcode 415. Add Strings | 大数加法

2017-09-02
阅读 2 分钟
3.5k
Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2.

leetcode 414. Third Maximum Number | set

2017-09-02
阅读 2 分钟
1.5k
Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity must be in O(n).

leetcode 409. Longest Palindrome

2017-09-01
阅读 2 分钟
1.8k
Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters.

leetcode 405. Convert a Number to Hexadecimal | &0xf和>>4

2017-09-01
阅读 2 分钟
1.8k
Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used.

leetcode 401. Binary Watch

2017-09-01
阅读 3 分钟
1.9k
A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59).

leetcode 400. Nth Digit

2017-09-01
阅读 1 分钟
3.5k
前记不得不说自己还欠缺很多, 这道easy的leetcode原题就在今年阿里笔试编程题(第二题)出现了, 当时没有AC, 做题不够实在伤感...

leetcode 383. Ransom Note

2017-09-01
阅读 3 分钟
1.7k
前记 360三面已过,后接能力测评,一切都没感觉有何异样, 然而并没有收到offer, 躺在了所谓的offer池(备胎池)中, 甚是伤感, 只能说他皮任他皮,我刷我的题~

leetcode 350. Intersection of Two Arrays II

2017-08-31
阅读 3 分钟
1.7k
Note:Each element in the result should appear as many times as it shows in both arrays.The result can be in any order.Follow up:What if the given array is already sorted? How would you optimize your algorithm?What if nums1's size is small compared to nums2's size? Which algorithm is better?What i...

leetcode 349. Intersection of Two Arrays

2017-08-31
阅读 2 分钟
1.6k
Note:Each element in the result must be unique.The result can be in any order.

leetcode 345. Reverse Vowels of a String

2017-08-31
阅读 1 分钟
1.8k
Write a function that takes a string as input and reverse only the vowels of a string.

leetcode 344. Reverse String

2017-08-31
阅读 1 分钟
2.2k
Write a function that takes a string as input and returns the string reversed.

leetcode 342. Power of Four

2017-08-31
阅读 1 分钟
1.3k
Given an integer (signed 32 bits), write a function to check whether it is a power of 4.

leetcode 278. First Bad Version

2017-08-30
阅读 2 分钟
1.6k
You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the previous version, all the versions after a bad version are also bad.

leetcode 268. Missing Number

2017-08-30
阅读 2 分钟
2.2k
Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.

leetcode 258. Add Digits

2017-08-29
阅读 1 分钟
1.6k
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.

leetcode 257. Binary Tree Paths

2017-08-28
阅读 3 分钟
1.8k
Description Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: 1 / \2 3 \ 5All root-to-leaf paths are: ["1->2->5", "1->3"] My solution 未能找到合适的解决方案, 实际上还是对stack/遍历/回溯不够熟悉. Discuss 鉴于上周六去网易有道面试, 问到非递归...