自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 409. Longest Palindrome

/*Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters.This is case sensitive, for example "Aa" is not consid

2017-08-31 20:58:12 167

原创 290. 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 in str.Examples

2017-08-31 20:39:38 177

原创 274. 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 sc

2017-08-31 17:05:49 226

原创 242. Valid Anagram

/*Given two strings s and t, write a function to determine if t is an anagram of s.For example,s = "anagram", t = "nagaram", return true.s = "rat", t = "car", return false.Note:You may assume the st

2017-08-31 16:20:42 156

原创 219. Contains Duplicate II

/*Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the absolute difference between i and j is at most

2017-08-31 15:54:32 163

原创 217. Contains Duplicate

/*Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element

2017-08-31 15:40:00 198

原创 205. Isomorphic Strings

/*Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occurrences of a character must be replaced with another ch

2017-08-31 14:29:57 183

原创 204. Count Primes

/*Description:Count the number of prime numbers less than a non-negative number, n.*//*一个素数是一个自然数恰好具有两个不同的自然数的约数:1和它本身。通过Eratosthenes方法查找小于或等于给定整数n的所有素数: 1.创建从2到n:(2,3,4,...,n)的连续整数的列表。 2.最初,

2017-08-30 22:57:02 202

原创 202. Happy Number

/*Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares o

2017-08-30 20:41:50 176

原创 187. 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 DNA.Write

2017-08-30 20:17:01 169

原创 to_string 与 abs()

to_string 使用to_string时,出现:166_fractionToRecurringDecimal.cpp:24: error: call of overloaded ‘to_string(int)’ is ambiguous 把int型的数据转化为string时,提示是模糊的! 然后仔细查阅to_string的函数原型,在C++11中提供了9个函数重载: string to_

2017-08-30 16:34:04 960

原创 166. Fraction to Recurring Decimal

/*两个数相除,结果分为符号部分、整数部分、小数部分;先求整数部分与符号位,然后取绝对值,例如(int)a/b 是整数部分,a%b 是剩余部分,来转化为小数部分。如果两个数相除后的结果为无限循环小数,则分子部分的数字每次乘10来求取一位数,从一个非零数字开始每次除完分母都相同。注意数值的提升*/#include <stdio.h>#include <stdlib.h>#includ

2017-08-30 16:13:46 204

原创 648. Replace Words

/*In English, we have a concept called root, which can be followed by some other words to form another longer word - let's call this word successor. For example, the root an, followed by other, which

2017-08-30 11:40:38 376

原创 最大公约数与最小公倍数

参考:http://blog.csdn.net/niushuai666/article/details/7278027 最大公约数 最大公约数(英语:greatest common divisor,gcd),指两个或多个整数共同具有的最大约数,记为 {\displaystyle (a_{1},a_{2},\dots ,a_{n})} {\displaystyle (a_{1},a_{2},\do

2017-08-29 23:04:46 476

原创 149. Max Points on a Line

leetcode中第149题:Max Points on a Line,关于斜率,忙活了好长时间,使用double类型来存储斜率会造成斜率精度损失,可以使用long double类型,目前是通过测试了,个人感觉最好使用最简化的分子与分母表示斜率。对与有相同的斜率并拥有共同点的直线是一条直线,求得直线上的所有点即可,找出数量最大的即为所求。使用hash表来对相同的斜率计数。/*Given n po

2017-08-29 22:52:01 223

原创 136. Single Number

/*Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using extra

2017-08-29 14:34:45 198

原创 94. Binary Tree Inorder Traversal

/*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: Recursive solution is trivial, c

2017-08-29 11:48:35 275

原创 76. Minimum Window Substring

给定两个字符串S和T,求在S中的一个最小的窗口,使得T中所有字母都出现。 思路:two pointers思想,用一个指针指向出现所有字符的结尾,另一个指针指向包含所有字符的开始,然后查看开始指针能不能将窗口变短。 使用hashtable来记录T串中的内容(键为字符,值为字符出现的 次数),然后查看S串中是否一一出现,根据字符出现的次数判断,对字符是否完全出现通过计数来判断。 在leetcode

2017-08-29 10:53:32 292

原创 105. Construct Binary Tree from Preorder and Inorder Traversal

/*Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.通过给出的前序遍历与中序遍历还原二叉树。前序遍历:先访问根节点,然后左节点、右节点中序遍历:先访问左节点,然后根节点、

2017-08-28 17:33:21 252

原创 90. Subsets II

/*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 = [1,2,2], a solution i

2017-08-28 11:31:57 202

原创 88. Merge Sorted Array

/*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 hold addition

2017-08-28 10:42:54 151

原创 85. Maximal Rectangle

/*Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing only 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 0R

2017-08-28 08:56:56 146

原创 84. 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 of each

2017-08-27 20:20:02 175

原创 81. Search in Rotated Sorted Array II

/*Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Suppose an array sorted in ascending order is rotated at some

2017-08-27 15:36:59 361

原创 初识动态规划

动态规划通常用来解决最优化问题在这类问题中,我们通过做出一组选择来达到最优解。在做出每个选择的同时,通常会生成与原问题形式相同的子问题。当多于一个选择子集都生成相同的子问题时,动态规划技术通常就会很有效,其关键技术技术对每个这样的子问题都保存其解,当相同的子问题重复出现时即可避免重复计算。(空间换时间)**设计动态规划算法**1.刻画一个最优解的结构特征2.递归的定义最优解的值3.计算最优解的

2017-08-25 23:02:15 306

原创 分治、归并、快排

分治法步骤: 划分问题:把问题的实例划分成子问题 递归求解:递归解决子问题 合并问题:合并子问题的解得到原问题的解归并排序步骤: 划分问题:把序列分成元素个数尽量相等的两半 递归求解:把两半元素分别排序 合并问题:把两个有序表合成一个 快速排序步骤: 划分问题:把数组的各个元素重排后分成左右两部分,使得左边的任意元素都

2017-08-25 21:28:53 228

原创 79. 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 verticall

2017-08-24 15:55:04 188

原创 78 Subsets

/*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:[ [3], [1],

2017-08-24 11:26:01 197

原创 75. Sort Colors

/*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 integers

2017-08-24 10:11:12 202

原创 74. Search a 2D Matrix

/*Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.The first integer of each

2017-08-23 22:51:25 313

原创 73. Set Matrix Zeroes

/*Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra space?A straight forward solution using O(mn)

2017-08-23 15:21:36 227

原创 66. Plus One

/*Given a non-negative integer represented as a non-empty array of digits, plus one to the integer.You may assume the integer do not contain any leading zero, except the number 0 itself.The digit

2017-08-23 09:17:50 203

原创 64. Minimum Path Sum

/*Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down or right

2017-08-22 22:25:21 174

原创 63 Unique Paths II

/*Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 and 0 respectively in the gri

2017-08-22 20:49:25 182

原创 62. Unique Paths

#include #include #include using namespace std;class Solution {public: int uniquePaths(int m, int n) {//超时!!!!! if(m==1 && n==1) return 1; if(m<1 || n<1) return 0; int path

2017-08-22 15:56:28 171

原创 59. Spiral Matrix II

/*Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example,Given n = 3,You should return the following matrix:[ [ 1, 2, 3 ], [ 8, 9, 4 ], [

2017-08-22 11:41:44 183

原创 57. 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 times.Ex

2017-08-22 10:13:37 226

原创 56. 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].思路: 先按照集合中个区间的左边界的大小排序,升序; 若 i<j,i、j为第几个区间,则

2017-08-21 22:04:38 179

原创 55. Jump Game

/*Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determine i

2017-08-21 14:57:57 273

原创 54 spiral matrix

http://blog.csdn.net/qustdrjhj?viewmode=list/*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:[ [

2017-08-21 14:15:55 287

基于ARM11视频采集的WiFi小车

采用ARM11(tiny6410,Linux系统可以直接采用官网的来烧写)做控制器,使用V4L2打开摄像头,opencv(2.0版本的)处理视频,其中包含人脸检测的程序(人脸检测参考的其他大神的程序),用QT写的界面程序并运行在ARM11上,通过socket通信和手机客户端通信并控制小车的运动状态。

2016-06-19

空空如也

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

TA关注的人

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