自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(85)
  • 收藏
  • 关注

原创 Reverse Linked List

Problem:Reverse a singly linked list.链表问题80%可以用递归!Solutions:C++/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x)

2017-11-08 11:25:42 158

原创 LeetCode (Count Primes)

Problem:Description:Count the number of prime numbers less than a non-negative number, n.Solutions:C++:class Solution {public: int countPrimes(int n) { vector isPrime(n, true)

2017-11-01 10:57:19 152

原创 MATLAB图像处理函数

bwboundaries : 提取二值图像边界,返回坐标

2017-09-05 21:07:43 276

原创 LeetCode (Binary Tree Right Side View)

Problem:Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.For example:Given the following binary

2017-08-16 18:37:35 196

原创 LeetCode (Largest Number)

Problem:Given a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330.Note: The re

2017-07-24 09:44:28 205

转载 十三种基于直方图的图像全局二值化算法原理、实现、代码及效果。

原博地址      图像二值化的目的是最大限度的将图象中感兴趣的部分保留下来,在很多情况下,也是进行图像分析、特征提取与模式识别之前的必要的图像预处理过程。这个看似简单的问题,在过去的四十年里受到国内外学者的广泛关注,产生了数以百计的阈值选取方法,但如同其他图像分割算法一样,没有一个现有方法对各种各样的图像都能得到令人满意的结果。     在这些庞大的分类方法中,基于直方图的全

2017-07-13 11:39:41 353

原创 LeetCode (Min Stack)

Problem: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

2017-07-12 09:34:27 156

原创 LeetCode (Insertion Sort List)

Problem:Sort a linked list using insertion sort.Solution:/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x),

2017-07-10 15:49:17 133

原创 LeetCode (Binary Tree Postorder Traversal)

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

2017-07-09 12:40:01 138

原创 LeetCode (Binary Tree Preorder Traversal)

Problem:Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,2,3].Solution:

2017-07-05 16:22:57 135

原创 LeetCode (Reorder List)

Problem: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},

2017-07-04 18:32:09 135

原创 LeetCode (Linked List Cycle II)

Problem:Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Solution:/** * Definition for singly-linked list. * struct ListNode { * int val;

2017-07-03 20:04:47 129

原创 LeetCode (Single Number II)

Problem:Given an array of integers, every element appears three times except for one, which appears exactly once. Find that single one.Solution:class Solution {public: int singleNumber(

2017-06-29 23:04:23 151

原创 LeetCode (Longest Consecutive Sequence)

Problem: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 sequen

2017-06-27 19:35:49 174

原创 LeetCode (Sum Root to Leaf Numbers)

Problem: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.F

2017-06-26 18:09:36 150

原创 LeetCode (Best Time to Buy and Sell Stock II)

Problem: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 li

2017-06-25 13:12:17 167

原创 LeetCode (Best Time to Buy and Sell Stock)

Problem: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

2017-06-24 14:03:10 165

原创 LeetCode (Triangle)

Problem:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[ [2],

2017-06-23 22:21:34 187

原创 LeetCode (Pascal's Triangle)

Problem:Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]]Solution:cla

2017-06-22 16:16:21 160

原创 LeetCode ( Populating Next Right Pointers in Each Node II)

Problem:Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your previous solution still work?Note:You may only

2017-06-21 19:37:30 142

原创 LeetCode (Populating Next Right Pointers in Each Node)

Problem:Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointer to point to its nex

2017-06-20 17:02:29 153

原创 LeetCode (Flatten Binary Tree to Linked List)

Problem:Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened tree should look l

2017-06-19 11:38:15 143

原创 LeetCode (Path Sum II)

Problem: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-06-14 20:52:56 148

原创 LeetCode (Path Sum)

Problem: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

2017-06-13 21:53:51 134

原创 LeetCode ( Minimum Depth of Binary Tree)

Problem:Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.Solution:/** * Defi

2017-06-05 20:24:49 133

原创 LeetCode (Maximum Depth of Binary Tree)

Problem:Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.Solution1:/** * Def

2017-06-04 10:03:58 242

原创 LeetCode (Binary Tree Zigzag Level Order Traversal)

Problem: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:

2017-06-03 21:16:03 178

原创 LeetCode (Binary Tree Level Order Traversal)

Problem: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-06-02 22:13:04 150

原创 LeetCode (Unique Binary Search Trees)

Problem: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

2017-05-28 11:23:09 156

原创 LeetCode (Binary Tree Inorder Traversal)

Problem:Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree [1,null,2,3], 1 \ 2 / 3return [1,3,2].Note: 

2017-05-27 13:41:18 142

原创 LeetCode (Reverse Linked List II)

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

2017-05-26 22:51:49 131

原创 LeetCode (Decode Ways)

Problem:A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, determine

2017-05-25 23:36:52 160

原创 LeetCode (Subsets II)

Problem:Given a collection of integers that might contain duplicates, nums, return all possible subsets.Note: The solution set must not contain duplicate subsets.For example,If nums = 

2017-05-24 17:49:49 142

原创 LeetCode (Gray Code)

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

2017-05-23 23:32:50 198

原创 LeetCode (Remove Duplicates from Sorted List)

Problem: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.Solution:

2017-05-21 22:40:00 124

原创 LeetCode (Remove Duplicates from Sorted List II)

Problem;Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example,Given 1->2->3->3->4->4->5, return 1->2->5

2017-05-19 09:45:49 191

原创 LeetCode (Remove Duplicates from Sorted Array II)

Problem:Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array nums = [1,1,1,2,2,3],Your function should return length = 5, wit

2017-05-18 16:19:01 158

原创 LeetCode (Subsets)

Problem:Given a set of distinct integers, nums, return all possible subsets.Note: The solution set must not contain duplicate subsets.For example,If nums = [1,2,3], a solution is:[

2017-05-17 21:20:26 124

原创 LeetCode (Minimum Window Substring)

Problem: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

2017-05-16 16:43:45 207

原创 LeetCode (Sort Colors)

Problem: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

2017-05-15 15:08:03 133

空空如也

空空如也

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

TA关注的人

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