[置顶] LeetCode Algorithms' Solutions 2018-01-01 LeetCode LeetCode, 算法 “ Talk is cheap, show me the code! ”— Linus Torvalds 如果题解中有谬误或疑问的地方，欢迎大家留言交流！ # Title Acceptance Difficulty 1 Two Sum 40.2% 1Easy 2 Add Two Numbers 30.4% 2Medium 7 Reverse Integer 25.1% 1Easy 8 String to Integer (atoi) 14.4% 2Medium 9 Palindrome Number 41.5% 1Easy 13 Roman to Integer 51.3% 1Easy 20 Valid Parentheses 35.7% 1Easy 21 Merge Two Sorted Lists 45.4% 1Easy 27 Remove Element 43.3% 1Easy 28 Implement strStr() 31.0% 1Easy 35 Search Insert Position 40.4% 1Easy 38 Count and Say 39.2% 1Easy 50 Pow(x, n) 27.4% 2Medium 53 Maximum Subarray 42.5% 1Easy 69 Sqrt(x) 30.4% 1Easy 70 Climbing Stairs 43.1% 1Easy 83 Remove Duplicates from Sorted List 41.7% 1Easy 84 Largest Rectangle in Histogram 30.0% 3Hard 100 Same Tree 49.2% 1Easy 101 Symmetric Tree 42.5% 1Easy 102 Binary Tree Level Order Traversal 46.6% 2Medium 104 Maximum Depth of Binary Tree 58.8% 1Easy 107 Binary Tree Level Order Traversal II 45.3% 1Easy 108 Convert Sorted Array to Binary Search Tree 48.8% 1Easy 112 Path Sum 36.8% 1Easy 118 Pascal’s Triangle 44.1% 1Easy 119 Pascal’s Triangle II 41.6% 1Easy 121 Best Time to Buy and Sell Stock 45.9% 1Easy 122 Best Time to Buy and Sell Stock II 50.6% 1Easy 125 Valid Palindrome 29.9% 1Easy 136 Single Number 58.6% 1Easy 153 Find Minimum in Rotated Sorted Array 42.3% 2Medium 154 Find Minimum in Rotated Sorted Array II 38.8% 3Hard 155 Min Stack 35.2% 1Easy 167 Two Sum II - Input array is sorted 48.9% 1Easy 168 Excel Sheet Column Title 28.4% 1Easy 169 Majority Element 51.2% 1Easy 171 Excel Sheet Column Number 50.7% 1Easy 172 Factorial Trailing Zeroes 37.2% 1Easy 189 Rotate Array 28.6% 1Easy 190 Reverse Bits 29.9% 1Easy 191 Number of 1 Bits 41.7% 1Easy 202 Happy Number 44.1% 1Easy 204 Count Primes 28.0% 1Easy 206 Reverse Linked List 52.2% 1Easy 217 Contains Duplicate 50.5% 1Easy 226 Invert Binary Tree 56.7% 1Easy 231 Power of Two 41.6% 1Easy 237 Delete Node in a Linked List 51.6% 1Easy 242 Valid Anagram 50.6% 1Easy 258 Add Digits 53.4% 1Easy 263 Ugly Number 40.3% 1Easy 264 Ugly Number II 35.4% 2Medium 268 Missing Number 47.3% 1Easy 278 First Bad Version 28.6% 1Easy 283 Move Zeroes 53.4% 1Easy 292 Nim Game 55.4% 1Easy 303 Range Sum Query - Immutable 36.2% 1Easy 307 Range Sum Query - Mutable 27.1% 2Medium 326 Power of Three 41.3% 1Easy 338 Counting Bits 63.8% 2Medium 342 Power of Four 39.9% 1Easy 344 Reverse String 62.6% 1Easy 345 Reverse Vowels of a String 40.7% 1Easy 349 Intersection of Two Arrays 52.4% 1Easy 350 Intersection of Two Arrays II 46.5% 1Easy 367 Valid Perfect Square 39.3% 1Easy 371 Sum of Two Integers 51.4% 1Easy 383 Ransom Note 49.1% 1Easy 387 First Unique Character in a String 48.8% 1Easy 389 Find the Difference 52.6% 1Easy 401 Binary Watch 45.0% 1Easy 404 Sum of Left Leaves 48.6% 1Easy 405 Convert a Number to Hexadecimal 41.6% 1Easy 409 Longest Palindrome 47.3% 1Easy 412 Fizz Buzz 58.7% 1Easy 413 Arithmetic Slices 55.1% 2Medium 414 Third Maximum Number 28.6% 1Easy 415 Add Strings 42.9% 1Easy 419 Battleships in a Board 65.0% 2Medium 437 Path Sum III 41.7% 1Easy 442 Find All Duplicates in an Array 59.6% 2Medium 447 Number of Boomerangs 48.9% 1Easy 448 Find All Numbers Disappeared in an Array 52.5% 1Easy 451 Sort Characters By Frequency 54.6% 2Medium 453 Minimum Moves to Equal Array Elements 48.9% 1Easy 455 Assign Cookies 48.0% 1Easy 459 Repeated Substring Pattern 39.2% 1Easy 461 Hamming Distance 69.9% 1Easy 463 Island Perimeter 60.0% 1Easy 476 Number Complement 62.0% 1Easy 479 Largest Palindrome Product 27.0% 3Hard 485 Max Consecutive Ones 54.4% 1Easy 492 Construct the Rectangle 48.3% 1Easy 496 Next Greater Element I 58.4% 1Easy 500 Keyboard Row 61.5% 1Easy 501 Find Mode in Binary Search Tree 38.8% 1Easy 504 Base 7 44.5% 1Easy 506 Relative Ranks 47.8% 1Easy 513 Find Bottom Left Tree Value 57.8% 2Medium 520 Detect Capital 52.2% 1Easy 530 Minimum Absolute Difference in BST 49.5% 1Easy 541 Reverse String II 44.9% 1Easy 543 Diameter of Binary Tree 46.1% 1Easy 557 Reverse Words in a String III 62.9% 1Easy 561 Array Partition I 68.1% 1Easy 563 Binary Tree Tilt 46.8% 1Easy 566 Reshape the Matrix 58.3% 1Easy 575 Distribute Candies 59.0% 1Easy 599 Minimum Index Sum of Two Lists 47.0% 1Easy 606 Construct String from Binary Tree 50.9% 1Easy 617 Merge Two Binary Trees 68.9% 1Easy 637 Average of Levels in Binary Tree 57.7% 1Easy 654 Maximum Binary Tree 71.7% 2Medium 657 Robot Return to Origin 70.5% 1Easy 661 Image Smoother 47.7% 1Easy 665 Non-decreasing Array 19.6% 1Easy 669 Trim a Binary Search Tree 59.6% 1Easy 671 Second Minimum Node In a Binary Tree 43.2% 1Easy 上一篇 LeetCode155 Min Stack 下一篇 条件生成对抗网络(Conditional GANs)