
LeetCode
文章平均质量分 72
为而不争熙
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
[LeetCode]Search in Rotated Sorted Array
Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). You are given a target value to search. If found in the array retur原创 2015-10-20 13:09:05 · 329 阅读 · 0 评论 -
[LeetCode162]Find Peak Element
题目来源:https://leetcode.com/problems/find-peak-element/ 点击打开链接 A peak element is an element that is greater than its neighbors. Given an input array where num[i] ≠ num[i+1], find a peak element原创 2015-11-10 15:51:36 · 278 阅读 · 0 评论 -
[LeetCode104]Maximum Depth of Binary Tree
题目来源:https://leetcode.com/problems/maximum-depth-of-binary-tree/ 本题地址 Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root原创 2015-11-12 14:54:54 · 317 阅读 · 0 评论 -
[LeetCode237]Delete Node in a Linked List
题目来源:https://leetcode.com/problems/delete-node-in-a-linked-list/ Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the linke原创 2015-11-12 15:33:17 · 234 阅读 · 0 评论 -
[LeetCode]Two Sum
Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers such that they add up to the target, whe原创 2015-10-26 17:01:37 · 320 阅读 · 0 评论 -
[LeetCode125]Valid Palindrome
题目来源:https://leetcode.com/problems/valid-palindrome/ 原题地址 Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example, "A m原创 2015-11-11 21:15:53 · 252 阅读 · 0 评论 -
[LeetCode162]Nim Game
题目来源:https://leetcode.com/problems/nim-game/ 题目地址 You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1原创 2015-11-12 14:40:26 · 337 阅读 · 0 评论 -
[LeetCode283]Move Zeroes
题目来源:https://leetcode.com/problems/move-zeroes/ Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. For exam原创 2015-11-12 19:31:24 · 339 阅读 · 0 评论 -
[LeetCode29]Merge Sorted Array
题目来源:https://leetcode.com/problems/merge-sorted-array/ Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: You may assume that nums1 has enough原创 2015-11-13 22:22:28 · 353 阅读 · 0 评论 -
[LeetCode258] Add Digits
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: 3 + 8 = 11, 1 + 1 = 2. Since 2 has on原创 2016-10-28 20:54:51 · 298 阅读 · 0 评论 -
[LeetCode 226] Invert Binary Tree
Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 递归的方法: /** * Definition for a binary tree node. * struct TreeNode {原创 2016-10-28 21:54:03 · 345 阅读 · 0 评论 -
[LeetCode154]Find Minimum in Rotated Sorted Array II
题目来源:https://leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii/ 点击打开链接 Follow up for "Find Minimum in Rotated Sorted Array": What if duplicates are allowed? Would this affect原创 2015-11-09 14:04:57 · 272 阅读 · 0 评论 -
[LeetCode153]Find Minimum in Rotated Sorted Array
题目来源:https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/ 点击打开链接 Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become原创 2015-11-09 13:59:23 · 304 阅读 · 0 评论 -
[LeetCode18]4Sum
题目来源:https://leetcode.com/problems/4sum/点击打开链接 Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array原创 2015-11-09 13:54:53 · 356 阅读 · 0 评论 -
[LeetCode]Add Digits
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: 3 + 8 = 11, 1 + 1 = 2. Since 2 has on原创 2015-10-20 10:47:37 · 419 阅读 · 0 评论 -
[LeetCode]Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could negative integers be palindromes? (ie, -1) If you are thinking of converting the integer to string, no原创 2015-10-08 18:37:02 · 272 阅读 · 0 评论 -
[LeetCode]Maximum Depth of Binary Tree
Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. 分析: 递归 /** * Definition for原创 2015-10-20 11:10:27 · 331 阅读 · 0 评论 -
[LeetCode]Pascal's Triangle
Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5, Return [ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] ] 分析 要得到一个帕斯卡三角, 我们只需要找到规律即可。原创 2015-10-21 22:40:33 · 316 阅读 · 0 评论 -
[LeetCode]Remove Element
Given an array and a value, remove all instances of that > value in place and return the new length. The order of elements can be changed. It doesn't matter what you leave beyond the new length.原创 2015-10-21 21:50:16 · 235 阅读 · 0 评论 -
[LeetCode]Plus One
Given a non-negative number represented as an array of digits, plus one to the number. The digits are stored such that the most significant digit is at the head of the list. class Solution66{原创 2015-10-21 21:51:48 · 229 阅读 · 0 评论 -
[Leetcode]Merge Sorted Array
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold addit原创 2015-10-22 10:47:52 · 376 阅读 · 0 评论 -
[LeetCode15]3Sum
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. Note: Elements in a triplet (a,b,c原创 2015-11-09 13:45:57 · 232 阅读 · 0 评论 -
[LeetCode74]Search a 2D Matrix
题目来源:https://leetcode.com/problems/search-a-2d-matrix/ 点击打开链接 Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Intege原创 2015-11-09 14:14:39 · 276 阅读 · 0 评论 -
[LeetCode16]3Sum Closed
题目来源:点击打开链接https://leetcode.com/problems/3sum-closest/ Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three原创 2015-11-09 13:48:52 · 533 阅读 · 0 评论 -
[LeetCode] 263. Ugly Number
原题地址 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 example, 6, 8 are ugly while 14 is not原创 2017-01-25 17:55:11 · 344 阅读 · 0 评论