- 博客(11)
- 收藏
- 关注
原创 LeetCode:Palindrome Number
题目:Determine whether an integer is a palindrome.判断一整数是否为回文。思路:判断颠倒后的数与原来的数是否相等。代码:class Solution {public: bool isPalindrome(int x) { if(x < 0)return false; int sum = 0
2017-08-08 21:56:37 194
原创 LeetCode:String to Integer (atoi)
题目:Implement atoi to convert a string to an integer.将字符串转换为整数。思路:注意符号以及溢出的处理。代码:class Solution {public: int myAtoi(string str) { int number = 0,i = 0,sign = 1; while(s
2017-08-08 20:16:53 188
原创 LeetCode:Reverse Integer
题目:Reverse digits of an integer.反转整数思路:可与INT_MIN和INT_MAX比较判断溢出。代码:class Solution {public: int reverse(int x) { long long res = 0; while(x) { res = res*10 +
2017-08-05 21:37:24 171
原创 LeetCode:Longest Palindromic Substring
题目:Given a string s, find the longest palindromic substring ins. You may assume that the maximum length of s is 1000.Example: Input: "babad"Output: "bab"Note: "aba" is also a valid answer.
2017-08-05 20:51:02 168
原创 LeetCode: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)).Example 1:nums1
2017-08-05 16:13:44 247
原创 LeetCode: Longest Substring Without Repeating Characters
题目:Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the answer is "b",
2017-08-04 20:31:51 151
原创 LeetCode: Add Two Numbers
题目:You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and ret
2017-08-04 19:57:35 168
原创 《机器学习实战》k-近邻算法
本文是博主阅读《机器学习实战》后的笔记,包含对其中算法的理解及代码实现1.什么是k-近邻算法所谓K近邻算法,即是给定一个训练数据集,对新的输入实例,在训练数据集中找到与该实例最邻近的K个实例,这K个实例的多数属于某个类,就把该输入实例分类到这个类中。2.k-近邻算法的优缺点优点 :精度高、对异常值不敏感、无数据输入假定。缺点:计算复杂度高、空间复杂度高。适用数据范围:数值型
2017-08-03 10:47:28 292
原创 LeetCode two sum
two sumGiven 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-06-03 11:29:13 218
原创 OpenCV中GC方法求视差图的实现
前段时间需要用到GC方法实现视差图,参考了http://blog.csdn.net/mailang2008/article/details/5873883的内容,试验之后发现还有一些需要注意的地方,记录下来方便以后查看1.影像的读取由于GC方法要求左右影像均是8位的灰度图像故读取影像时需要进行一次转换。//读取左右影像 IplImage* pImgleft = cvLoadIma
2017-03-31 20:52:24 8133 8
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人