自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(60)
  • 资源 (2)
  • 收藏
  • 关注

原创 [LeetCode]24. Swap Nodes in Pairs

题目描述:Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you should return the list as 2->1->4->3. Your algorithm should use only

2017-10-27 12:49:11 222

原创 [LeetCode]20. Valid Parentheses

题目描述:Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid. The brackets must close in the correct order, “()” and “()[]{}” are all va

2017-10-27 12:27:43 203

原创 [LeetCode]21. Merge Two Sorted Lists

题目描述:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. 解题思路:已知两个链表有序,可以利用两个指针,对两个链表依次遍历。将较小的指针所指向的节点添加到新的链表中。

2017-10-27 12:25:20 191

原创 [LeetCode]19. Remove Nth Node From End of List

题目描述:Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the

2017-10-27 10:34:15 199

原创 [LeetCode]26. Remove Duplicates from Sorted Array

题目描述:Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this in place

2017-10-27 10:31:11 181

原创 [LeetCode]58. Length of Last Word

题目描述:Given a string s consists of upper/lower-case alphabets and empty space characters ’ ‘, return the length of last word in the string. If the last word does not exist, return 0. 分析:返回一个长传字符串

2017-10-23 14:22:29 194

原创 [LeetCode]28. Implement strStr()

题目描述:Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. 分析:返回子串在字符串中第一次出现的位置 解题思路:题目要求返回子串在父串第一次出现的位置。设置两个指针,一个指向父字符串一个

2017-10-23 09:38:10 192

原创 [LeetCode]27. Remove Element

题目描述:Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for another array, you must do this in place with constant memory.

2017-10-20 21:52:05 166

原创 [LeetCode]66. Plus One

题目描述:Given a non-negative number represented as an array of digits, plus one to the number. You may assume the integer do not contain any leading zero, except the number 0 itself. The digits ar

2017-10-20 21:36:10 202

原创 [LeetCode]83. Remove Duplicates from Sorted List

题目描述:Given a sorted linked list, delete all duplicates such that each element appear only once. 分析:删除一个列表中的相同元素 For example, Given 1->1->2, return 1->2. Given 1->1->2->3->3, r

2017-10-20 20:55:49 164

原创 [LeetCode]88. Merge Sorted Array

题目描述:Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. 分析:将两个有序的数组合并到一个有序的数组中 解题思路1:已知两个数组有序,利用两个指针将两个数组从头到尾遍历,将两个数组中较小的那个元素优先给第三个数组 ,完成合并。再将第三个数组赋给nums1[

2017-10-20 20:39:23 163

原创 [LeetCode]102. Binary Tree Level Order Traversal

题目描述:Given a binary tree, return the level order traversal of its nodes’ values. (ie, from left to right, level by level). For example: Given binary tree [3,9,20,null,null,15,7],

2017-10-20 20:04:42 200

原创 [LeetCode]104. 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. 分析:查找一个二叉树的最大深度 解题思路:求二叉树的深度

2017-10-20 17:04:14 183

原创 [LeetCode]101. Symmetric Tree

题目描述:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmetric: 1 / \ 2 2 / \ /

2017-10-20 17:01:27 159

原创 [LeetCode]100. Same Tree

题目描述:Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical and the nodes have the same value. 分析:判

2017-10-20 13:55:38 177

原创 [LeetCode]119. Pascal's Triangle II

题目描述:Given an index k, return the kth row of the Pascal’s triangle. For example, given k = 3, Return [1,3,3,1]. 解题思路:先求出pascal矩阵,在返回第i行的结果。public List<Integer> getRow(int rowIndex){

2017-10-20 12:55:15 201

原创 [LeetCode]118. 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

2017-10-20 10:24:58 188

原创 [LeetCode]112. Path Sum

题目描述:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. For example: Given the below bi

2017-10-19 16:11:40 179

原创 [LeetCode]111. Minimum Depth of Binary Tree

题目描述:Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. 分析:查找一棵二叉树从根节点到叶子节点的最短距离 解题思

2017-10-19 15:55:55 188

原创 [LeetCode]110. Balanced Binary Tree

题目描述:Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never

2017-10-19 14:46:22 177

原创 [LeetCode]141. Linked List Cycle

题目描述:Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space? 分析:判断在一个链表中是否存在环 解题思路:设置两个指针, 其中一个指针每次走一步,另外一个指针每次走两步。如果两个指针相遇,则表示有环。如果当其

2017-10-19 14:03:37 160

原创 [LeetCode]136. Single Number

题目描述: Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without

2017-10-19 10:19:20 149

原创 [LeetCode]125. Valid Palindrome

题目描述:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example, “A man, a plan, a canal: Panama” is a palindrome. “race a car

2017-10-19 09:40:50 187

原创 [LeetCode]169. Majority Element

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the array is non-empty and the majority element al

2017-10-18 21:05:43 216

原创 [LeetCode]168. Excel Sheet Column Title

题目描述:Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 分析:根据数字返回在excel表格中的表示 1 -> A 2 -> B 3 -> C … 26 -> Z

2017-10-18 19:33:33 154

原创 [LeetCode]171. Excel Sheet Column Number

题目描述:Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding column number. For example: 分析:返回excel中对应的列表数的大小 解题思路:类似于将26进制的数

2017-10-18 19:04:01 191

原创 [LeetCode]190. Reverse Bits

题目描述:Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 00111

2017-10-18 18:53:07 160

原创 [LeetCode]191. Number of 1 Bits

题目描述:Write a function that takes an unsigned integer and returns the number of ’1’ bits it has (also known as the Hamming weight). For example, the 32-bit integer ’11’ has binary representation 000

2017-10-18 15:52:47 159

原创 [LeetCode]172. Factorial Trailing Zeroes

题目描述:Given an integer n, return the number of trailing zeroes in n!. 分析:返回n!后面的尾0个数 解题思路:将n除以5后的结果累加public int trailingZeroes(int n) { int result = 0; while(n>0){ n=n/5;

2017-10-18 15:42:46 164

原创 [LeetCode]189. Rotate Array

题目描述:Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. 分析:将数组元素循环右移k个单位 解题思路:题意是将数组元素循环右移k个单元,可以

2017-10-18 14:04:13 152

原创 [LeetCode]204. Count Primes

Description: Count the number of prime numbers less than a non-negative number, n. 分析:返回n范围内素数的个数 解题思路:使用打表法,找出1~n中的素数,之后遍历统计。以空间换时间。打表思路:判断当前数是否为素数,从2开始。如果当前数为素数,则count++。内存循环当前素数乘之后必定为非素数,循环结

2017-10-18 13:01:06 179

原创 [LeetCode]206. Reverse Linked List

题目描述:Reverse a singly linked list. 分析:将一个链表原地逆转 解题思路:将头结点与之后的节点断开,将之后的节点使用头插法连接到头结点后面。public ListNode reverseList(ListNode head) { if(head==null)return null; //考虑到head在LeetCode中为实际存

2017-10-18 11:10:16 171

原创 [LeetCode]203. Remove Linked List Elements

题目描述:Remove all elements from a linked list of integers that have value val. Example Given: 1 –> 2 –> 6 –> 3 –> 4 –> 5 –> 6, val = 6 Return: 1 –> 2 –> 3 –> 4 –> 5 分析:删除链表中特定值的链表节点

2017-10-18 10:58:19 148

原创 [LeetCode]219. Contains Duplicate II

题目描述:Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the difference between i and j is at most k. 分

2017-10-17 17:15:11 156

原创 [LeetCode]226. Invert Binary Tree

题目描述:Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9to 4 / \ 7 2 / \ / \ 9 6 3 1 解题思路1:将一个二叉树的左右子树逆转。通过层序遍历将二叉树的节点放入队列中,并通过出队来交换该节点的左右子树public TreeNode invertTree(Tre

2017-10-17 15:39:03 157

原创 [LeetCode]217. Contains Duplicate

题目描述:Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every elemen

2017-10-17 15:34:14 157

原创 [LeetCode]258. 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

2017-10-17 15:27:06 145

原创 [LeetCode]257. Binary Tree Paths

题目描述:Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: 1 / \ 2 3 \ 5 All root-to-leaf paths are: [“1->2->5”, “1->3”] 解题思路:深度优先遍历

2017-10-17 14:26:32 141

原创 [LeetCode]242. Valid Anagram

题目描述:Given two strings s and t, write a function to determine if t is an anagram of s. For example, s = “anagram”, t = “nagaram”, return true. s = “rat”, t = “car”, return false. Note:

2017-10-17 11:15:26 150

原创 [LeetCode]303. Range Sum Query - Immutable

题目描述:Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: Given nums = [-2, 0, 3, -5, 2, -1] sumRange(0, 2) -> 1 su

2017-10-17 11:00:59 163

wpf事件参考

wpf事件参考,个人感觉挺有用的,希望对大家有帮助!

2012-09-27

WPF控件参考

WPF控件参考,个人感觉挺不错的,希望对大家有帮助!

2012-09-27

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除