- 博客(16)
- 收藏
- 关注
转载 grep命令的与或非
原文标题:7 Linux Grep OR, Grep AND, Grep NOT Operator Examples原文地址:http://www.thegeekstuff.com/2011/10/grep-or-and-not-operators/【Chinese follows English】Question: Can you explai
2015-03-17 00:37:15 2417
原创 LeetCode 119 Pascal's Triangle II
题:https://leetcode.com/problems/pascals-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:Could you optimiz
2015-03-17 00:16:20 496
原创 LeetCode 023 Merge K Sorted Lists
题:https://leetcode.com/problems/merge-k-sorted-lists/Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.解法一:将K个链表做K-1次归并,每次归并是对两个链表的归并,最终得到一个
2015-03-12 02:52:05 414
原创 LeetCode 021 Merge Two Sorted Lists
题:https://leetcode.com/problems/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 li
2015-03-12 01:43:50 342
原创 LeetCode 088 Merge Sorted Array
题:https://leetcode.com/problems/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
2015-03-12 00:36:28 369
原创 LeetCode 147 Insertion Sort List
题:https://leetcode.com/problems/insertion-sort-list/Sort a linked list using insertion sort./** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode
2015-03-12 00:16:05 339
转载 LeetCode 题目总结/分类
转载自豆瓣: http://www.douban.com/note/330562764/,的确需要有一个分类列表在指导自己在准备时间不够充分的情况下接触到更多考点的题欢迎参考我的leetcode代码利用堆栈:http://oj.leetcode.com/problems/evaluate-reverse-polish-notation/http://oj.leetcod
2015-03-11 01:36:02 775
转载 LeetCode主题整理(4)链表及相关问题
转载自:http://blog.csdn.net/feliciafay/article/details/18944093Topic 1 反转链表Reverse Linked List II在第m~n个节点中反转单链表,注意这道题可以把代码写得很长,如果分为区间一[0,m-1],区间二[m-n],区间三[n+1,end]这三个区间的话。也可以写得很短,如果仔细观察发现
2015-03-11 01:32:34 430
原创 LeetCode 066 Plus one
题目:https://leetcode.com/problems/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
2015-03-11 01:26:50 374
原创 LeetCode 33 Search in Rotated Sorted Array 二叉查找(三)
题目:https://leetcode.com/problems/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
2015-03-10 01:45:13 543
原创 LeetCode 34 Search For A Range 二叉查找相关(二)
题目:https://leetcode.com/problems/search-for-a-range/Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must
2015-03-10 00:07:43 425
原创 LeetCode 35 Search Insert Position 二叉查找相关(一)
题目:https://leetcode.com/problems/search-insert-position/Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were
2015-03-09 23:41:02 300
原创 LeetCode 22 Generate Parentheses
连续两次随机到关于括号的题了,跟括号真有缘。。。好了,别的不多说,上代码:package ywheel.leetcode._22_generate_parentheses;import java.util.ArrayList;import java.util.List;/** * Given n pairs of parentheses, write a function to
2015-03-08 23:55:23 326
原创 LeetCode 32 Longest Valid Parentheses
题目大意是给定一个只有左右括号组成的字符串,求最长的valid字串长度,比如“()”的最长valid字串长度为2,“)()())”的最长valid字串为"()()",则长度为4.拿到这个题目第一反应就是用Stack,但是Stack里面装什么呢?如何表示Valid最大长度?后来想到是否能够把还没匹配好的括号的index放到stack中,如果有匹配的就pop,没有就push。当pop的时候
2015-03-08 22:20:28 358
原创 LeetCode 75 Sort Colors
public class Solution { public void sortColors(int[] A) { if (A == null || A.length == 0) return; int zero = 0; int two = A.length - 1; int i = 0; whil
2015-03-07 17:15:28 334
原创 LeetCode 129 Sum Root to Leaf Numbers
/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */public class Solution { publi
2015-03-07 16:33:49 296
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人