- 博客(36)
- 收藏
- 关注
转载 图像的基本几何变换
文章出处:http://www.cnblogs.com/wangguchangqing/p/4039095.htmlhttp://www.cnblogs.com/wangguchangqing/p/4045150.html
2015-12-28 15:19:41 453
转载 Leetcode209: Maximal Rectangle
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.给定一个矩阵中,只有0和1,求出这个矩阵的一个最大的子矩阵,其中只包含1.例如011011101001110111
2015-12-25 19:53:10 234
转载 Leetcode208: Largest Rectangle in Histogram
Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.Above is a histogram where width o
2015-12-25 19:50:50 245
转载 Leetcode207: 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)).该方法的核心是将原问题转变成一个寻找第k小
2015-12-25 19:30:39 384
转载 Leetcode206: 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,2,1,2,1]
2015-12-23 20:47:33 290
原创 Leetcode205: Find the Duplicate Number
Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number,
2015-12-23 11:14:54 311
原创 Leetcode204: N-Queens II
Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.有了上一题的解法,简单修改下即可class Solution {private: int num=0;public:
2015-12-22 21:43:34 318
转载 Leetcode203: 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 puzzle.
2015-12-22 21:39:12 450
原创 Leetcode202: Maximum Product of Word Lengths
Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may assume that each word will contain only lower case le
2015-12-18 14:38:32 485
转载 Leetcode201: Remove Duplicate Letters
Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must make sure your result is the smallest in lexicographical order a
2015-12-18 11:20:24 334
转载 Leetcode200: Super Ugly Number
Write a program to find the nth super ugly number.Super ugly numbers are positive numbers whose all prime factors are in the given prime list primes of size k. For example, [1, 2, 4, 7, 8, 13,
2015-12-17 19:15:54 457
原创 Leetcode199: Longest Increasing Subsequence
Given an unsorted array of integers, find the length of longest increasing subsequence.For example,Given [10, 9, 2, 5, 3, 7, 101, 18],The longest increasing subsequence is [2, 3, 7, 101], ther
2015-12-17 17:34:48 233
转载 Leetcode198: Minimum Height Trees
For a undirected graph with tree characteristics, we can choose any node as the root. The result graph is then a rooted tree. Among all possible rooted trees, those with minimum height are called mini
2015-12-17 16:57:08 435
转载 Leetcode197: Best Time to Buy and Sell Stock with Cooldown
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 (ie, buy on
2015-12-17 16:41:31 396
转载 C++文件读写详解(ofstream,ifstream,fstream)
在看C++编程思想中,每个练习基本都是使用ofstream,ifstream,fstream,以前粗略知道其用法和含义,在看了几位大牛的博文后,进行整理和总结:这里主要是讨论fstream的内容:[java] view plaincopyprint?#include ofstream //文件写
2015-12-16 17:17:10 388
转载 Leetcode196: Additive Number
dditive number is a string whose digits can form additive sequence.A valid additive sequence should contain at least three numbers. Except for the first two numbers, each subsequent number in the
2015-12-15 21:18:57 343
转载 Leetcode195: Range Sum Query - Mutable
Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.The update(i, val) function modifies nums by updating the element at index i to val.E
2015-12-15 20:56:48 278
原创 Leetcode194: Range Sum Query 2D - Immutable
Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2, col2).The above rectangle (with the
2015-12-14 17:09:42 333
原创 Leetcode193: Range Sum Query - Immutable
Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.Example:Given nums = [-2, 0, 3, -5, 2, -1]sumRange(0, 2) -> 1sumRange(2, 5) -> -1sumRan
2015-12-14 16:49:29 241
转载 Leetcode192: Serialize and Deserialize Binary Tree
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 connection link to be
2015-12-10 16:27:41 343
原创 Leetcode191: Bulls and Cows
You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each time your friend makes a guess, you provide a hint t
2015-12-10 11:26:53 228
转载 Leetcode190: 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 board with m
2015-12-09 20:03:32 318
转载 Leetcode189: Peeking Iterator
Given an Iterator class interface with methods: next() and hasNext(), design and implement a PeekingIterator that support the peek() operation -- it essentially peek() at the element that will be
2015-12-09 16:42:01 222
原创 Leetcode188: H-Index II
Follow up for H-Index: What if the citations array is sorted in ascending order? Could you optimize your algorithm?Hint:Expected runtime complexity is in O(log n) and the input is sorted.
2015-12-08 22:11:57 316
原创 Leetcode187: H-Index
Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index.According to the definition of h-index on Wikipedia: "A
2015-12-08 22:01:02 338
原创 Leetcode186: Perfect Squares
Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n.For example, given n = 12, return 3 because 12 = 4 + 4 + 4; given n =
2015-12-07 22:08:57 210
转载 Leetcode185: Integer to English Words
Convert a non-negative integer to its english words representation. Given input is guaranteed to be less than 231 - 1.For example,123 -> "One Hundred Twenty Three"12345 -> "Twelve Thousand Th
2015-12-07 21:31:08 299
原创 Leetcode184: Ugly Number II
Write a program to find the n-th ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence of the first
2015-12-05 23:54:24 230
转载 Leetcode183: Different Ways to Add Parentheses
Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are+, - and *.Example 1I
2015-12-05 23:27:17 302
转载 Leetcode182: Lowest Common Ancestor of a Binary Tree
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two node
2015-12-05 14:50:40 218
转载 Leetcode181:Number of Digit One
Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.For example:Given n = 13,Return 6, because digit 1 occurred in the follow
2015-12-05 13:34:14 280
原创 Leetcode180: 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.因为不超过n/3个数的数最多只有2个,可以定义两个变量,利用类似Majority Elemen
2015-12-04 17:17:08 274
转载 Leetcode179:Basic Calculator II
Implement a basic calculator to evaluate a simple expression string.The expression string contains only non-negative integers, +, -, *, / operators and empty spaces . The integer division should
2015-12-04 11:26:33 205
原创 Leetcode178: Basic Calculator
Implement a basic calculator to evaluate a simple expression string.The expression string may contain open ( and closing parentheses ), the plus + or minus sign -, non-negative integers and em
2015-12-04 10:53:55 332
转载 Leetcode177: 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 completely fille
2015-12-02 22:03:33 233
原创 Leetcode176: Maximal Square
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.For example, given the following matrix:1 0 1 0 01 0 1 1 11 1 1 1 11 0 0 1 0
2015-12-02 16:47:29 315
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人