摘要: struct ListNode{ int m_nValue; ListNode* m_pNext; } ListNode* CreateListNode(int value); void ConnectListNodes(ListNode* pCurrent, ListNode* pNext); void PrintListNode(ListNode* pNode); void... 阅读全文
posted @ 2018-10-29 14:57 OVS98 阅读(106) 评论(0) 推荐(0)
摘要: 一.题目请实现一个函数,把字符串中的每个空格替换成“%20”。例如,输入“We are happy!”,则输出“We%20are%20happy!”二.思路这里替换空格还会造成字符串长度的延长,这是本题的关键。如果是在原来的字符串上做修改,就有可能覆盖修改在该字符后面的内存,如果是创建新的字符串并在新的字符串上进行替换,那么我们可以分配足够多的内存。因而有两种解决方案,我们应该与面试官沟通一下。这... 阅读全文
posted @ 2018-10-26 11:03 OVS98 阅读(193) 评论(0) 推荐(0)
摘要: 一.题目 在一个二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数例如:从下面的二维数组中查找7返回true,查找5返回false 1 2 8 9 2 4 9 12 4 7 10 13 ... 阅读全文
posted @ 2018-10-26 10:20 OVS98 阅读(140) 评论(0) 推荐(0)
摘要: 一.题目一 在一个长度为n的数组里的所有数字都在0~n-1的范围内。数组中某些数字是重复的,但不知道有几个数字重复了,也不知道每个数字重复了几次。请找出数组中任意一个重复的数字。 例如: 输入长度为7的数组{2,3,1,0,2,5,3},那么对应的输出是重复的数字2或者3 二.思路 三.代码 方法一 阅读全文
posted @ 2018-10-25 21:11 OVS98 阅读(147) 评论(0) 推荐(0)
摘要: Description Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k. Example 1: N 阅读全文
posted @ 2018-10-24 22:16 OVS98 阅读(119) 评论(0) 推荐(0)
摘要: DescriptionGiven an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two... 阅读全文
posted @ 2018-10-24 20:37 OVS98 阅读(108) 评论(0) 推荐(0)
摘要: DescriptionGiven an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique quadruplets in the array which gives the... 阅读全文
posted @ 2018-10-24 20:11 OVS98 阅读(102) 评论(0) 推荐(0)
摘要: 一.题目 如下为类型CMyString的声明,请为该类型添加赋值运算符函数。 二.注意点 是否把返回值的类型声明为该类型的引用,并在函数结束前返回实例自身的引用(*this)。只有返回一个引用,才可以允许连续赋值。否则,如果函数的返回值是void,则应用该赋值运算符将不能进行连续赋值。 是否把传入的 阅读全文
posted @ 2018-10-24 12:29 OVS98 阅读(153) 评论(0) 推荐(0)
摘要: Description Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which 阅读全文
posted @ 2018-10-23 21:37 OVS98 阅读(193) 评论(0) 推荐(0)
摘要: 一.容器的定义 在数据存储上,有一种对象类型,它可以持有其它对象或指向其它对像的指针,这种对象类型就叫做容器。在c++中,容器指的是能够容纳各种数据类型的通用数据数据结构,是类模板。容器就是保存其它对象的对象,当然这是一个朴素的理解,这种“对象”还包含了一系列处理“其它对象”的方法。 二.容器的种类 阅读全文
posted @ 2018-10-22 17:35 OVS98 阅读(179) 评论(0) 推荐(0)