自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

原创 用两个栈实现队列的功能

用两个栈实现队列的功能思路如下: (1)将设有两个空栈A,B;A负责入队,B负责出队。 (2)入队时,将元素压入栈A (3)出队时,若B栈为空,将A中的元素全部出栈,并压入B中,然后B的栈顶元素出栈。若B栈不为空,直接将B的栈顶元素出栈。 转载请注明:康瑞的部落 » 用两个...

2015-05-31 12:34:03 611 0

原创 [LeetCode] Contains Duplicate II

Contains Duplicate II  Given an array of integers and an integer k, return true if and only if there are two distinct indices i and j in the arr...

2015-05-30 19:26:32 1689 0

原创 [LeetCode] Reorder List

Reorder List Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without alterin...

2015-05-28 22:19:35 600 0

原创 [LeetCode] Binary Tree Preorder Traversal (非递归的先序遍历)

Binary Tree Preorder Traversal   Given a binary tree, return the preorder traversal of its nodes' values. For example: Given binary tr...

2015-05-28 17:42:50 734 0

原创 [LeetCode] Insertion Sort List

Insertion Sort List Sort a linked list using insertion sort. 解题思路: 类似于插入排序法。与数组的插入排序法不同的是,链表的插入排序扫描顺序是从左往右扫描,找到第一个大于指定元素的节点N,然后将之插在N节点前面。 今天状态非...

2015-05-28 17:06:32 864 0

原创 [LeetCode] Maximum Subarray

Maximum Subarray Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given ...

2015-05-27 17:02:55 589 0

原创 [LeetCode] Jump Game

Jump Game   Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array...

2015-05-27 15:34:46 578 0

原创 [LeetCode] Pow(x, n)

Pow(x, n)  Implement pow(x, n). 解题思路: 这里n是整数,注意可能是负数,因此需要先将其转化成正数。若直接用循环的方法做,会产生超时错误。我们可以这么做。比如求2^6,我们需要求2^(2*3)=4^3=4*4^2,这样时间复杂度为O(logn)。 注意几个特殊的...

2015-05-26 23:45:37 1243 0

原创 [LeetCode] Anagrams

Anagrams   Given an array of strings, return all groups of strings that are anagrams. Note: All inputs will be in lower-case. 解题思路: anagra...

2015-05-26 16:28:39 600 0

原创 [LeetCode] Subsets

Subsets Given a set of distinct integers, nums, return all possible subsets. Note: Elements in a subset must be in non-descending order....

2015-05-26 15:11:49 645 0

原创 [LeetCode] Kth Largest Element in an Array

Kth Largest Element in an Array Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, ...

2015-05-25 20:25:04 2413 0

原创 [LeetCode] Combination Sum III

Combination Sum III Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and eac...

2015-05-25 17:18:39 2143 0

原创 [LeetCode] Contains Duplicate

Contains Duplicate Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at...

2015-05-25 16:19:39 3379 0

原创 [LeetCode] Rotate Image

Rotate Image You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follow up: Could you do ...

2015-05-22 23:35:51 783 0

原创 [LeetCode] House Robber II

House Robber II Note: This is an extension of House Robber. After robbing those houses on that street, the thief has found himself a new plac...

2015-05-22 22:50:49 1473 0

原创 程序远表白网,对Ta Say Love

历经两周构思与取材,两天编写代码,程序远表白网V1.0版已经上线啦。 网址:http://www.kangry.net/love/。 整合了当前网站其他人做的一些模板,修改了一些Bug。 目前尚不支持手机版的(手机版样式可能不对) 建议用Chorme、Firefox、IE9+等高级浏览器打...

2015-05-20 11:18:21 1729 0

原创 JS获得当前时间,并格式化

function getNowFormatDate() { var date = new Date(); var year = date.getFullYear(); var month = date.getMonth() + 1; var d = da...

2015-05-19 11:24:13 1837 0

原创 [LeetCode] Merge Sorted Array

Merge Sorted Array Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: You may assume that nu...

2015-05-17 17:22:44 803 0

原创 [LeetCode] Same Tree

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 structural...

2015-05-17 16:57:33 766 0

原创 [LeetCode] Symmetric Tree

Symmetric Tree Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree...

2015-05-17 16:50:36 890 0

原创 [LeetCode] Add and Search Word - Data structure design

Add and Search Word - Data structure design Design a data structure that supports the following two operations: void addWord(word) bool search(...

2015-05-17 16:16:52 1347 0

原创 [LeetCode] Binary Tree Level Order Traversal

Binary Tree Level Order Traversal   Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, l...

2015-05-16 20:09:06 637 0

原创 [LeetCode] Maximum Depth of Binary Tree

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...

2015-05-16 19:36:56 765 0

原创 [LeetCode] Course Schedule II

Course Schedule II There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prerequisites, for example to ...

2015-05-16 19:31:59 1225 0

原创 C# JavaScriptSerializer报错,json数据太长

ASP.NET平台中,用JavaScriptSerializer将返回的数据序列化,若返回的数据非常大,则可能会报如下错误: Exception information: Exception type: InvalidOperationException Exception message:...

2015-05-13 15:32:24 3423 1

原创 [LeetCode] Permutations II

Permutations II   Given a collection of numbers that might contain duplicates, return all possible unique permutations. For example, [1,1...

2015-05-13 13:34:37 570 0

原创 [LeetCode] Permutations

Permutations   Given a collection of numbers, return all possible permutations. For example, [1,2,3] have the following permutations: [1,2,3], [1,...

2015-05-13 13:03:12 733 0

原创 [LeetCode] Balanced Binary Tree

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...

2015-05-12 15:22:51 688 0

原创 [LeetCode] Minimum Depth of Binary Tree

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 fr...

2015-05-12 14:58:18 616 0

原创 [LeetCode] Pascal's Triangle II

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]. Note: C...

2015-05-12 14:40:27 637 0

原创 [LeetCode] Minimum Size Subarray Sum

Minimum Size Subarray Sum   Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the ...

2015-05-12 14:19:10 1592 0

原创 [LeetCode] Implement Trie (Prefix Tree)

Implement Trie (Prefix Tree) Implement a trie with insert, search, and startsWith methods. Note: You may assume that all inputs are cons...

2015-05-11 14:32:57 1397 0

原创 Azure云平台学习之路(三)——Cloud Services

1、什么是云服务? 能够部署高度可用的且可无限缩放的应用程序和API。简而言之,就是你写的CMD程序按照一定的框架进行少量修改就能运行在Azure云平台上。 2、Azure云服务有什么特点? (1)专注应用程序而不是硬件,PaaS的一种。 (2)支持多种框架和语言。 (...

2015-05-08 22:27:33 2580 0

原创 Azure云平台学习之路(二)——SQL Database

1、什么是SQL Database? 托管关系数据库,数据库即服务,IaaS的一种。 2、有哪些特点? (1)为SaaS应用提供可扩展的数据存储服务。 (2)易于操作大量的数据库。稍后介绍几种操作数据库的方法。 (3)性能更高,稳定性更好。基于Azure平台,高性能可扩展;多地...

2015-05-08 11:00:01 1211 0

原创 Azure云平台学习之路(一)——Azure简介

1、什么是Azure? Microsoft Azure是由微软所发展的一套云计算操作系统(云平台),提供各种优质的服务:计算、存储、数据、网络和应用程序。Azure意为天蓝色、蔚蓝色。 2、Azure特点? (1)平台即服务(Platform as a Service,PaaS)+ 基...

2015-05-08 10:58:28 3292 0

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

2015-05-07 14:57:02 644 0

原创 [LeetCode] Pascal's Triangle

Pascal's Triangle Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5, Return [ [...

2015-05-07 14:43:02 736 0

原创 [LeetCode] Remove Duplicates from Sorted List

Remove Duplicates from Sorted List Given a sorted linked list, delete all duplicates such that each element appear only once. For example, G...

2015-05-07 14:30:35 604 0

原创 [LeetCode] 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 distinct ways can yo...

2015-05-07 14:20:30 578 0

原创 [LeetCode] Course Schedule

There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prerequisites, for example to take course 0 you ...

2015-05-07 14:00:55 2038 0

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