自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Substring with Concatenation of All Words

You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once and without an

2014-09-27 08:03:08 437

原创 Divide Two Integers

class Solution: # @return an integer def divide(self, dividend, divisor): flag = False if (dividend 0 ) or (dividend > 0 and divisor < 0 ) : flag = True

2014-09-27 06:49:58 304

原创 Implement strStr

class Solution: # @param haystack, a string # @param needle, a string # @return a string or None def strStr(self, haystack, needle): if len(needle) > len(haystack) : return Non

2014-09-27 06:45:41 295

原创 Remove Element

Remove Element Total Accepted: 25135 Total Submissions: 75331My SubmissionsGiven an array and a value, remove all instances of that value in place and return the new length.The order o

2014-09-27 06:32:40 430

原创 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 with

2014-09-25 11:41:34 257

原创 Reverse Nodes in k-Group

Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is

2014-09-25 06:52:31 324

原创 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 constant space. Y

2014-09-25 06:47:52 298

原创 Merge k sorted Lists

Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.

2014-09-25 06:42:01 295

原创 Generate Parentheses

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:"((()))", "(()())", "(())()", "()(())", "()()

2014-09-25 06:36:40 309

原创 Valid Parentheses

class Solution: # @return a boolean def isValid(self, s): stack = [] for i in range(len(s)): if s[i] in '([{': stack.append(s[i]) if s[i

2014-09-25 06:33:59 243

原创 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 end, the

2014-09-25 06:26:55 318

原创 Letter Combination of phone number

class Solution: # @return a list of strings, [s1, s2] def letterCombinations(self, digits): def dfs(num, string, res): if num == length: res.append(string)

2014-09-24 02:51:54 421

原创 4 Sum

class Solution: # @return a list of lists of length 4, [[val1,val2,val3,val4]] def fourSum(self, num, target): numLen, res, dict = len(num), set(), {} if numLen < 4: return []

2014-09-24 02:45:02 276

原创 3 Sum Closet

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 integers. You may assume that each input would have exa

2014-09-22 07:07:15 359

原创 3 sum

class Solution: # @return a list of lists of length 3, [[val1,val2,val3]] def threeSum(self, num): num.sort() res = [] for i in range(len(num)-2): if i == 0

2014-09-22 06:46:25 376

原创 Longest Common Prefix

Write a function to find the longest common prefix string amongst an array of strings.class Solution: # @return a string def longestCommonPrefix(self, strs): minLength = 99999

2014-09-22 06:43:07 269

原创 Roman to Integer

Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.

2014-09-22 06:32:55 366

原创 Integer to Roman

Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.

2014-09-22 06:28:42 365

原创 COntainer with Most Water

Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Fin

2014-09-21 10:59:40 351

原创 Regular Expression Matching

Implement regular expression matching with support for '.' and '*'.class Solution: # @return a boolean def isMatch(self, s, p): dp=[[False for i in range(len(p)+1)] for j in range(len(

2014-09-21 10:55:16 310

原创 Valid Number

Validate if a given string is numeric.Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => trueNote: It is intended for the problem statement to be ambiguo

2014-09-21 10:37:13 307

原创 Palindrome Number

Determine whether an integer is a palindrome. Do this without extra space.

2014-09-20 08:31:55 227

原创 String to Interger (atoi)

Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input ca

2014-09-20 08:27:00 403

原创 Zigzag Conversion

The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L S I

2014-09-20 02:58:28 242

原创 Longest Palindromic Substring

Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.

2014-09-20 02:44:48 424

原创 Longest Substring without repeating Characters

Longest Substring Without Repeating Characters Total Accepted: 23252 Total Submissions: 104165My SubmissionsGiven a string, find the length of the longest substring without repeating cha

2014-09-19 07:30:58 399

原创 Median of Two Sorted Array

There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).

2014-09-19 07:12:47 327

原创 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

2014-09-19 06:57:51 333

原创 Leetcode练习- Symmetric Tree

ProblemsPick One!SubmissionsDiscussDonate  yipingwangSymmetric Tree Total Accepted: 21372 Total Submissions: 66732My SubmissionsGiven a binary tree, check whether

2014-08-19 05:49:03 603

原创 Leetcode练习-Grey Code

The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, print the sequence of gr

2014-08-19 04:37:40 502

原创 LeetCode练习-Merge Sorted Array

Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elements fro

2014-08-19 04:04:12 305

原创 Leetcode练习- Merge Two Sorted List

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.很biao zhun

2014-08-18 05:10:38 450

原创 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 you climb to the top?经典动态规划问题。 简单理解就是当前的解的形

2014-08-18 05:03:40 367

原创 Leetcode练习-Roman to Integer"M": 1000, "D": 500, "C": 100, "L": 50, "X": 10, "V": 5, "I": 1

Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.分析: 首先不超过3999,数字不大,不用考虑

2014-08-18 02:47:44 2260

原创 Leetcode练习-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, return 1->2->3.想duo

2014-08-18 02:11:31 336

原创 Leetcode练习-Binary Tree Inorder Traversal

Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,3,2].Note: Recursive solutio

2014-08-17 13:28:34 365

原创 Leetcode练习- Unique Binary Search Tree

Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1 \

2014-08-17 13:01:31 501

原创 Leetcode练习-Best Time to Buy and Sell Stock II

Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy on

2014-08-17 03:25:52 360

原创 Leetcode练习 Best Time to Buy and Sell Stock

Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock),

2014-08-17 03:11:33 389

原创 Leetcode练习- Reverse Integer

Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321click to show spoilers.Have you thought about this?Here are some good questions to ask before c

2014-08-17 02:51:48 423

MySQL 存储过程

MYSQL存储过程 详细介绍 数据库研究必备

2009-09-08

c#2008从入门到精通

C#2008 比较全面的一本书,在别的网上找到的,应该会有人需要吧。拿出来供大家下载

2008-09-25

空空如也

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

TA关注的人

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