
C++编程语言
文章平均质量分 75
一杯拿铁go
好记性不如烂笔头
展开
-
MFC与unicode的纠结
关于MFC的小总结原创 2015-09-17 20:31:03 · 1963 阅读 · 0 评论 -
【C++】数组中后前差值最大的值
LeetCode 121Best Time to Buy and Sell Stock 题意:Say you have an array for which the ith element is the price of a given stock on day i. buy one and sell one share of the stock原创 2017-11-13 10:51:18 · 1426 阅读 · 0 评论 -
【C++】去除数组中的某数且不使用额外空间
题目:Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for another array【C++】去除数组中的某数且不使用额外空间原创 2017-11-04 11:18:33 · 1517 阅读 · 0 评论 -
【C++】KMP浅析及其代码
对于匹配文本串中子串出现的位置的问题。对KMP进行了浅析,并附上代码。原创 2017-10-22 16:02:02 · 2565 阅读 · 3 评论 -
【C++】高效判断单链表是否有环以及单链表的创建
判断单链表是否有环,不借助额外的空间,时间复杂度为O(n)原创 2016-03-30 11:05:20 · 806 阅读 · 0 评论 -
【C++】数数:用数字来数数Count and Say
Count and Say题目:The count-and-say sequence is the sequence of integers with the first five terms as following:1. 1;2. 11 ; 3. 21 4. 12115. 1112211原创 2017-11-05 17:01:11 · 1417 阅读 · 0 评论 -
【C++】判断是不是2、3、4的幂数
判断是不是2的幂数。若n是2的幂数的话,那么n的二进制中含有1的只有1位;.判断是不是3的幂数判断是不是4的幂数//判断n是不是4的幂数原创 2017-11-20 22:11:10 · 1308 阅读 · 0 评论 -
【C++】两个字符串相加
题意:Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".两个字符串相加原创 2017-12-01 19:28:59 · 10479 阅读 · 0 评论 -
【C++】动态规划方法以及Maximum Length of Repeated Subarray
一,动态规划 动态规划的本质是递归,动态规划在递归的基础上通过空间来换取时间,来解决问题。它是通过:原问题(N)—>子问题(N-1)—>原问题(N),这样的方式将大的问题分解成一个个小的问题来求解,通过解决一个个小的问题最终将大问题解决了。 二,寻找两个数组中相同最长连续子数组问题原创 2017-11-22 20:09:23 · 229 阅读 · 0 评论 -
【C++】数组指针和指针数组
数组指针指针数组原创 2017-11-23 12:19:15 · 321 阅读 · 0 评论 -
【C++】char* 与char []定义的区别
char* 与char []定义的区别原创 2017-11-23 14:26:48 · 6155 阅读 · 0 评论 -
【C++】工作中遇到的难点
一,explicit C++ explicit关键字用来修饰类的构造函数,表明该构造函数是显式的。 构造函数有显示和隐式之分。构造函数默认的式隐式的,如下:1. class MyClass 2. { 3. public: 4. MyClass( int num ); 5. } 6. //. 7. MyClass obj = 10; //ok,convert int to原创 2017-12-12 15:10:42 · 744 阅读 · 0 评论 -
【C++】C++封装、继承、多态小结
C++封装、继承、多态 面向对象的三个基本特征面向对象的三个基本特征是:封装、继承、多态。其中,封装可以隐藏实现细节,使得代码模块化;继承可以扩展已存在的代码模块(类);它们的目的都是为了——代码重用。而多态则是转载 2017-12-17 11:12:28 · 374 阅读 · 0 评论 -
【python】统计文件中的字符串数目
统计文件中的字符一个txt文件中已知数据格式为:C4D/suC4D/max/AE统计每个字段出现的次数,比如C4D、maya原创 2017-11-02 14:10:43 · 12235 阅读 · 0 评论 -
【C++】数组中连续子数组的最大和
题意: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,-1,2,1] 计算数组中连续子数组原创 2017-11-10 15:24:16 · 2164 阅读 · 0 评论 -
【C++】反转单链表(面试的时候屡次被问到)
问题:已知一个单链表,将这个单链表反转过来,并返回反转之后的单链表。 思想:使用头插法的思想,将原本单链表中的数据反转,即每次插入数据的时候,不是将数据放到链表的末尾而是放到链表的头部。原创 2017-11-01 21:58:29 · 624 阅读 · 0 评论 -
【C++】C++函数返回数组
关于函数返回数组以及数组的定义的一些记录原创 2017-10-18 09:49:40 · 1375 阅读 · 0 评论 -
【C++】数组中两元素之和为目标值
题目:Given an array of integers, return indices of the two numbers such that they add up to a specific target. 寻找数组中两元素之和为目标值的数值的下标。原创 2017-10-28 17:33:52 · 1021 阅读 · 0 评论 -
【C++】Reverse digits of an integer
题目:将整数翻转过来。如:Example1: x = 123, return 321Example2: x = -123, return -321本题在写的时候要注意两个问题: 1,当数字为100之类的数的时候应该返回什么数? 2,注意数字的翻转的时候会出现越界的情况,如x=100000003时,翻转后的数字是会越界的。原创 2017-10-28 17:21:59 · 360 阅读 · 0 评论 -
【C++】判断一个数是不是回文数,不使用额外的空间
题目描述:Determine whether an integer is a palindrome. Do this without extra space.不适用额外空间判断整数是不是回文数。原创 2017-10-28 17:11:17 · 1003 阅读 · 0 评论 -
【C++】找数组中唯一出现两次的数
题:假设你有一个用1001个整数组成的数组,这些整数是任意排列的,但是你知道所有的整数都在1到1000(包括1000)之间。此外,除一个数字出现两次外,其他所有数字只出现一次。假设你只能对这个数组做一次处理,用一种算法找出重复的那个数字。如果你在运算中使用了辅助的存储方式,那么你能找到不用这种方式的算法吗?分析:方法一、若使用辅助的存储方式,该选择何种存储方式呢?可使用hash的存原创 2017-05-09 10:51:01 · 4773 阅读 · 0 评论 -
【C++】将罗马数字转换成阿拉伯数字
题目:Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 将罗马数字转换成阿拉伯数字。 方法一:从前往后的计算方法二:从后往前计算原创 2017-10-29 14:22:00 · 5690 阅读 · 0 评论 -
【C++】string数组最长前缀
题目:Write a function to find the longest common prefix string amongst an array of strings. 找出字符串中字符的最长前缀。原创 2017-10-29 16:40:11 · 539 阅读 · 0 评论 -
【C++】字符串中的括号是否匹配
题目: Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.The brackets must close in the correct order, “()” and “()[]{}” are all valid原创 2017-10-30 16:58:28 · 4082 阅读 · 1 评论 -
【C++】去除排序数组中重复的元素
去除排序数组中重复的元素原创 2017-10-30 18:08:23 · 4837 阅读 · 0 评论 -
【C++】关于字符串参数传递的小技巧
刷题时的小技巧原创 2016-03-06 18:56:08 · 2984 阅读 · 0 评论 -
【C++编程题】高效判断单链表是否有环以及单链表的创建
判断单链表是否有环,不借助额外的空间,时间复杂度为O(n)原创 2017-10-13 18:41:39 · 739 阅读 · 0 评论 -
【C++】动态规划:最长递增子序列和建桥问题
问题描述: 求一个一维数组的最长递增子序列,时间复杂度尽可能小。 例如:数组 1, -1,2,-3,4,-5,6,-7它的最长递增子序列是 1,2,4,6,最后返回4.原创 2017-11-09 14:02:41 · 957 阅读 · 0 评论 -
【C++】继承
对于继承来说,其基本准则为: 1,public可以被任意实体访问; 2,protected只能被子类以及自己的成员函数访问; 3,privated只能被自己的成员函数访问; 4,基函数的类型,继承方式共同决定了子类的类型。其优先级为:private > protected > public例如,继承方式为“public“,基函数类型为“protected“那么子类的类型为“protected原创 2017-12-17 18:26:09 · 315 阅读 · 0 评论