自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(67)
  • 资源 (1)
  • 收藏
  • 关注

原创 Sliding Window Maximum

题目: Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the knumbers in the window. Each time the sliding

2015-10-18 21:02:59 1598

原创 Next Permutation

题目: Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the lowest

2015-10-18 16:22:21 1606

原创 Game of Life

题目: According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970." Given a boar

2015-10-18 13:38:15 2452

原创 Median of Two Sorted Arrays

题目: There are two sorted arrays nums1 and nums2 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)). 分析: 参考代码: pu

2015-10-13 14:06:41 1511

原创 Word Pattern

题目: Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word

2015-10-13 13:58:11 1907

原创 Nim Game

题意: You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone wi

2015-10-13 13:20:51 1934

转载 B树、B-树、B+树、B*树

http://www.cnblogs.com/oldhorse/archive/2009/11/16/1604009.html B树        即二叉搜索树:        1.所有非叶子结点至多拥有两个儿子(Left和Right);        2.所有结点存储一个关键字;        3.非叶子结点的左指针指向小于其关键字的子树,右指针指向大于其关键字

2015-10-09 10:04:58 1017

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

2015-10-03 20:11:07 965

原创 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]. 分析: 首先根据每个interval的第一个元素对interval进行排序 Col

2015-10-03 16:27:17 958

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

2015-10-03 16:15:56 1005

原创 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 each combination should be a unique set of numbers. Ensure that n

2015-10-03 15:59:47 947

原创 Count Complete Tree Nodes

题目: Given a complete binary tree, count the number of nodes. Definition of a complete binary tree from Wikipedia: In a complete binary tree every level, except possibly the last, is completel

2015-10-03 15:52:46 1136

原创 Restore IP Addresses

题目: Given a string containing only digits, restore it by returning all possible valid IP address combinations. For example: Given "25525511135", return ["255.255.11.135", "255.255.111.35"]

2015-10-03 15:40:03 935

原创 Best Time to Buy and Sell Stock IV

题目: 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 at most k transactions. Note: Y

2015-10-03 15:26:59 1284

原创 Best Time to Buy and Sell Stock III

题目: 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 at most two transactions. Note:

2015-10-03 15:11:04 949

原创 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 be in the order of O(log n). If the target is n

2015-10-03 14:54:08 904

原创 Longest Consecutive Sequence

题目: Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example, Given [100, 4, 200, 1, 3, 2], The longest consecutive elements sequence is

2015-10-03 14:24:50 1003

原创 Majority Element II

题目: Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(1) space. Hint: How many majority elements coul

2015-10-03 14:13:35 955

原创 Binary Tree Zigzag Level Order Traversal

题目: Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between). For example: Given

2015-10-03 13:48:43 826

原创 ***Binary Tree Maximum Path Sum

题目: Given a binary tree, find the maximum path sum. For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child connecti

2015-10-03 13:41:49 669

原创 Sum Root to Leaf Numbers

题目: Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->2->3 which represents the number 123. Find

2015-10-03 13:31:59 320

原创 Convert Sorted List to Binary Search Tree

题目: Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. 分析: 建树,肯定是借助递归!! 先使用第一个节点; 先建左子树,然后赋给root的左指针;这里的巧妙之处在于建立左子树的时候顺便把下一个节点(下一个root

2015-10-03 13:21:39 268

原创 Reverse Linked List II

题目: Reverse a linked list from position m to n. Do it in-place and in one-pass. For example: Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3->2->5->NULL. Note: Given m, n sa

2015-10-03 12:21:36 230

原创 Partition List

题目: Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of the nodes i

2015-10-03 12:17:24 287

原创 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 altering the nodes' values. For example, Given {1,2,3,4}, reorder

2015-10-03 10:45:03 280

原创 Repeated DNA Sequences

题目: All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes useful to identify repeated sequences within the DN

2015-10-03 10:30:21 303

原创 Longest Valid Parentheses

题目: Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. For "(()", the longest valid parentheses substring is

2015-10-03 09:53:26 405

原创 Multiply Strings

题目: Given two numbers represented as strings, return multiplication of the numbers as a string. Note: The numbers can be arbitrarily large and are non-negative. 分析: 大整数的乘法; 参考代码如下: http://

2015-10-02 20:41:26 348

原创 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], and

2015-10-02 18:34:34 303

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

2015-10-02 17:54:52 314

原创 Sudoku Solver

题目: Write a program to solve a Sudoku puzzle by filling the empty cells. Empty cells are indicated by the character '.'. You may assume that there will be only one unique solution.

2015-10-02 17:26:39 300

原创 Word Search II

题目: Given a 2D board and a list of words from the dictionary, find all words in the board. Each word must be constructed from letters of sequentially adjacent cell, where "adjacent" cells are

2015-10-02 17:14:24 397

原创 Word Search

题目: Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or v

2015-10-02 16:25:12 319

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

2015-10-02 16:14:32 308

原创 Trapping Rain Water

题目: Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. For example,  Given [0,1,0,2,1,0,1,3

2015-10-02 16:11:01 285

原创 Product of Array Except Self

题目: https://leetcode.com/problems/product-of-array-except-self/ Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all th

2015-10-02 15:57:24 292

原创 Combination Sum II

题目: Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. Each number in C may only be used once in th

2015-10-02 13:26:40 288

原创 Subsets

题目: Given a set of distinct integers, nums, return all possible subsets. Note: Elements in a subset must be in non-descending order.The solution set must not contain duplicate subsets.

2015-10-02 12:47:47 317

原创 Subsets II

题目: https://leetcode.com/problems/subsets-ii/ Given a collection of integers that might contain duplicates, nums, return all possible subsets. Note: Elements in a subset must be in non-d

2015-10-02 11:20:37 279

原创 **Palindrome Partitioning

题目: https://leetcode.com/problems/palindrome-partitioning/ Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partition

2015-10-02 10:40:58 243

Weka系统中的关联规则

weka系统中的管理啊规则,lift,leverage,confidence,等等兴趣度度量规则解释和定义

2013-08-30

空空如也

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

TA关注的人

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