自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(41)
  • 资源 (5)
  • 收藏
  • 关注

原创 LeetCode 131. Palindrome Partitioning

description: Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For example, given s = “aab”, Return[ [“aa”,”

2017-02-19 09:38:15 252

原创 LeetCode 225. Implement Stack using Queues

description: Implement the following operations of a stack using queues.push(x) – Push element x onto stack. pop() – Removes the element on top of the stack. top() – Get the top element. empty() –

2017-02-18 09:27:38 181

原创 LeetCode 232. Implement Queue using Stacks

description: Implement the following operations of a queue using stacks.push(x) – Push element x to the back of queue. pop() – Removes the element from in front of queue. peek() – Get the front elem

2017-02-17 23:15:25 189

原创 LeetCode 155.Min Stack

description: Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) – Push element x onto stack. pop() – Removes the element on top of the stack. to

2017-02-17 22:07:20 210

原创 LeetCode 75.Sort Colors

description: 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 the

2017-02-16 18:21:57 225

原创 LintCode Sort Letters by Cases

description: Given a string which contains only letters. Sort it by lower case first and upper case second.NoticeIt’s NOT necessary to keep the original order of lower-case letters and upper case lett

2017-02-16 17:13:35 377

原创 LintCode Interleaving Positive and Negative Numbers

description: Given an array with positive and negative integers. Re-range it to interleaving with positive and negative integers.NoticeYou are not necessary to keep the original order of positive inte

2017-02-16 16:42:48 460

原创 LintCode on Array by Odd and Even

description: Partition an integers array into odd number first and even number second.Have you met this question in a real interview? Yes Example Given [1, 2, 3, 4], return [1, 3, 2, 4] 非常简单,直接使用t

2017-02-16 16:11:49 239

原创 LintCode Kth Smallest Number in A Unsorted Array

description: Find the kth smallest numbers in an unsorted integer array.Have you met this question in a real interview? Yes Example Given [3, 4, 1, 2, 5], k = 3, the 3rd smallest numbers are [1, 2,

2017-02-16 15:46:10 590

原创 LintCode Partition Array

description: Given an array nums of integers and an int k, partition the array (i.e move the elements in “nums”) such that:All elements < k are moved to the left All elements >= k are moved to the ri

2017-02-15 11:45:44 285

原创 LeetCode 125. Valid Palindrome

description: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example, “A man, a plan, a canal: Panama” is a palindrome. “race a car”

2017-02-15 11:08:32 178

原创 LeetCode 283. Move Zeroes

description: Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0, 3, 12], after call

2017-02-14 17:21:54 167

原创 LeetCode 88. Merge Sorted Array

description: Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note: You may assume that nums1 has enough space (size that is greater or equal to m + n) to h

2017-02-14 15:58:54 188

原创 Meger Sort

Meger Sort 也是一种比较常用的算法。这种算法的时间复杂度是O(nlogn),时间复杂度虽然比quick sort要好,但是该算法的空间复杂度为O(n), but quick sort is O(1), 所有快速排序算法又叫做原地排序算法,整合排序算法的是一种先局部后整体的方法,与快速排序的过程正好相反。但是整合排序是一种稳定的排序算法。可是由于整合排序和算法的空间复杂素非常大,所以该方法在

2017-02-14 12:40:59 438

原创 Quick Sort

Quick sort 是一种常用的算法。 quick sort 的常用算法实现。其中有三个重要的点求出pivot点,求去该点的时候可以使用 int pivot = nums[(start + end) / 2]; 不使用int pivot = nums[0] 或 int pivot = nums[end] 是为了避免出现时间复杂度为O(n ^ 2)的情况出现。当array是已经排序好的数组

2017-02-14 11:00:32 248

原创 Quick sort VS Merge sort

比较快速排序与归并排序的联系与区别:时间复杂度:都是 O(nlogn) 但是快速排序是平均 O(nlogn),归并排序是最好最坏都是 O(nlogn)空间复杂度:快速排序耗费 O(1) 的额外空间,归并排序不得不耗费 O(n) 的额外空间。排序稳定性:快速排序是不稳定的排序算法。归并排序是稳定的排序算法。http://baike.baidu.com/view/547325.htm 分治的思想:快速排

2017-02-13 21:49:46 392

原创 LintCode Two Sum Closest

description: Given an array nums of n integers, find two integers in nums such that the sum is closest to a given number, target.Return the difference between the sum of the two integers and the targe

2017-02-12 09:14:48 1293

原创 LeetCode 1. Two Sum java solution with HashMap

description: Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not us

2017-02-12 08:50:54 254

原创 LeetCode 122. Best Time to Buy and Sell Stock II

description: 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 (i

2017-02-12 08:20:29 134

原创 LeetCode 121. Best Time to Buy and Sell Stock

description: 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 th

2017-02-12 08:07:57 191

翻译 LintCode Subarray Sum

description: Given an integer array, find a subarray where the sum of numbers is zero. Your code should return the index of the first number and the index of the last number.NoticeThere is at least on

2017-02-11 09:56:43 249

原创 LeetCode 53. Maximum Subarray

description: 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,-

2017-02-11 09:25:00 135

原创 LeetCode 210. Course Schedule II

description: 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 have to first take course 1, which is expres

2017-02-09 15:34:45 185

原创 LeetCode 207.Course Schedule

description: 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 have to first take course 1, which is expres

2017-02-09 10:31:03 218

原创 LintCode Topological Sorting

description: Given an directed graph, a topological order of the graph nodes is defined as follow:For each directed edge A -> B in graph, A must before B in the order list. The first node in the orde

2017-02-08 17:54:36 280

原创 LeetCode 133. Clone Graph

description: Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ’s undirected graph serialization: Nodes are labeled uniquely.We use # as a separator for

2017-02-08 15:54:38 316

原创 LintCode Search Graph Node

Description: Given a undirected graph, a node and a target, return the nearest node to given node which value of it is target, return NULL if you can’t find.There is a mapping store the nodes’ values

2017-02-08 10:51:21 584

原创 LeetCode Graph Valid Tree

description: Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), write a function to check whether these edges make up a valid tree.NoticeYou can assum

2017-02-08 10:24:26 447

转载 图的基础知识

【1】图的基本概念(1)图是由顶点集合以及顶点间的关系集合组成的一种数据结构。   Graph = (V,E)  V是顶点的又穷非空集合;E是顶点之间关系的有穷集合,也叫边集合。 (2)有向图:顶点对是有序的;无向图:顶点对是无序的。 (3)无向边:若顶点Vi到Vj之间的边没有方向,则称这条边为无向边,用无序偶对(Vi,Vj)来表示。  如果图中任意两个顶点

2017-02-07 16:14:01 563

原创 LeetCode 103. Binary Tree Zigzag Level Order Traversal

description: 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: Give

2017-02-07 15:07:04 171

原创 时间复杂度公式

搜索的时间复杂度:O(答案总数 * 构造每个答案的时间) 举例:Subsets问题,求所有的子集。子集个数一共 2^n,每个集合的平均长度是 O(n) 的,所以时间复杂度为 O(n * 2^n),同理 Permutations 问题的时间复杂度为:O(n * n!)动态规划的时间复杂度:O(状态总数 * 计算每个状态的时间复杂度) 举例:triangle,数字三角形的最短路径,状态总数约 O(n

2017-02-05 10:19:04 1600

原创 LeetCode 297. Serialize and Deserialize Binary Tree

description: Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connecti

2017-02-04 23:52:30 192

原创 LeetCode 107. Binary Tree Level Order Traversal II

description: Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left to right, level by level from leaf to root).For example: Given binary tree [3,9,20,nu

2017-02-04 17:13:42 148

原创 LeetCode 102. Binary Tree Level Order Traversal

description: Given a binary tree, return the level order traversal of its nodes’ values. (ie, from left to right, level by level).For example: Given binary tree [3,9,20,null,null,15,7], 3 / \

2017-02-04 08:21:08 133

原创 Java Quene

java中queue的使用 Queue接口与List、Set同一级别,都是继承了Collection接口。LinkedList实现了Queue接 口。Queue接口窄化了对LinkedList的方法的访问权限(即在方法中的参数类型如果是Queue时,就完全只能访问Queue接口所定义的方法 了,而不能直接访问 LinkedList的非Queue的方法),以使得只有恰当的方法才可以使用。Blocki

2017-02-04 07:53:59 527

原创 LeetCode 98. Validate Binary Search Tree

description: Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only nodes with keys less than the node

2017-02-03 16:12:36 171

原创 LeetCode112. Path Sum java solution

description: Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example: Given the below binary tr

2017-02-03 10:26:02 179

原创 LeetCode113. Path Sum II

description: Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum.For example: Given the below binary tree and sum = 22, 5 / \

2017-02-03 10:09:46 163

原创 LintCode Binary Tree Longest Consecutive Sequence II

description: Given a binary tree, find the length of the longest consecutive sequence path. The path could be start and end at any node in the treeHave you met this question in a real interview? Yes

2017-02-02 16:15:56 616

原创 LintCode Binary Tree Longest Consecution Sequence

Binary Tree Longest Consecutive Sequence 这道题目在leetcode上是带锁的题目,只能在lintcode上面去做 description: Given a binary tree, find the length of the longest consecutive sequence path.The path refers to any seq

2017-02-02 15:25:10 233

机器学习(吴恩达)week2编程作业

机器学习(吴恩达)week2编程作业

2017-07-23

研究生“计算机通信新技术”课程复习题(2016年)

研究生“计算机通信新技术”课程复习题(2016年)

2017-01-11

基于Hessian滤波器的血管增强算法

基于Hessian滤波器的血管增强算法

2017-01-02

颜色相关图

颜色相关图

2015-11-07

空空如也

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

TA关注的人

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