- 博客(121)
- 收藏
- 关注
原创 Django1.6中models模型关联的方法整理
1、models.ForeignKey参考:Django 1.6 documentation-------models
2014-08-13 01:54:35
1303
原创 记一下mysql中的一些命令
1、修改表名alter table [old_name] rename [new_name]2、清空表delete from [tablename]3、重置自增主键值alter table [table_name] auto_increment=1
2014-08-09 02:31:52
533
转载 Python3.4下使用pymysql插入数据后没有反应的问题
用pymysql模块对MySQL进行操作,执行insert语句以后没有报错,也没有任何fanhui
2014-07-06 20:21:27
4532
原创 Sublime Text 3中写Python需要的一些设置
百度到的关于ST3设置Python的信息非常少。折腾一天多了,今天总算是搞了个cha
2014-06-25 23:12:48
1688
原创 【LeetCode】Combinations
题目描述:Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[ [2,4], [3,4], [2,3], [1,2], [1,3],
2014-06-22 21:27:00
505
原创 【LeetCode】Minimum Window Substring
题目描述:Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S = "ADOBECODEBANC"T = "ABC"Minimum win
2014-06-22 17:51:46
472
转载 【LeetCode】Sort Colors
题目描述:Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use th
2014-06-22 02:23:57
460
原创 【LeetCode】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:Integers in each row are sorted from left to right.The first inte
2014-06-21 14:48:14
502
原创 【LeetCode】Set Matrix Zeroes
题目描述:Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra space?A straight forward solutio
2014-06-21 10:22:12
523
原创 【LeetCode】Simplify Path
题目描述:Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"Corner Cases:Did you consider the case
2014-06-21 09:05:30
472
原创 【LeetCode】Edit Distance
题目描述:Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitted
2014-06-21 00:38:35
514
原创 【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?dp
2014-06-19 22:04:19
444
原创 【LeetCode】Sqrt(x)
题目描述:Implement int sqrt(int x).Compute and return the square root of x.跟前面的几道题目类似,通过左移的方法来j
2014-06-19 21:24:20
489
原创 【LeetCode】Text Justification
题目描述:Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.You should pack your words in a greedy appro
2014-06-19 20:49:26
490
原创 【LeetCode】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
2014-06-18 21:18:45
494
原创 【LeetCode】Add Binary
题目描述:Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".跟
2014-06-18 21:13:39
416
原创 【LeetCode】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.
2014-06-18 13:40:25
428
原创 【LeetCode】Unique Paths I && II && Minimum Path Sum
题目描述:Unique PathsA robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The ro
2014-06-18 13:38:48
473
原创 【LeetCode】Rotate List
题目描述:Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL.
2014-06-17 23:32:18
619
原创 【LeetCode】Spiral Matrix II
题目描述:Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example,Given n = 3,You should return the following matrix:[ [ 1, 2, 3 ], [ 8,
2014-06-17 16:49:03
337
原创 【LeetCode】Permutation Sequence
题目描述:The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence (ie, for n = 3):"123""132""
2014-06-17 15:48:49
414
原创 【LeetCode】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.Note
2014-06-16 03:04:49
440
原创 【LeetCode】N-Queens II
题目描述:Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.
2014-06-16 02:43:32
523
原创 【LeetCode】Insert Interval
题目描述:Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start
2014-06-16 02:31:17
384
原创 【LeetCode】Merge Intervals
题目描述:Given a collection of intervals, merge all overlapping intervals.For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18].zhi
2014-06-15 15:15:29
391
原创 【LeetCode】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 represents your maximum jump length at that position.
2014-06-15 02:16:04
358
原创 【LeetCode】Spiral Matrix
题目描述:Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example,Given the following matrix:[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9
2014-06-15 02:00:44
406
原创 【LeetCode】Maximum Subarray
题目描述:Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [−2,1,−3,4,−1,2,1,−5,4],the contiguous subarray [4
2014-06-15 00:23:54
404
原创 【LeetCode】N-Queens
题目描述:The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all distinct solutions to the n-quee
2014-06-14 20:35:42
490
原创 【LeetCode】Anagrams
题目描述:Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.Anagram的意思就是paiu
2014-06-14 10:24:52
417
原创 【LeetCode】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 this in-place?
2014-06-13 21:35:33
425
原创 【LeetCode】Permutations II
题目描述:Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2] have the following unique permutations:[1,1,2], [1,2,1], a
2014-06-13 21:02:27
390
原创 【LeetCode】Permutations
题目描述:Given a collection of numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], and [3,2,1].
2014-06-13 20:13:53
450
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅