码迷,mamicode.com
首页 >  
搜索关键字:careercup    ( 212个结果
careercup-数组和字符串1.7
1.7 编写一个算法,若M*N矩阵中某个元素为0,则将其所在的行与列清零。类似于leetcode中的Set Matrix ZeroesC++实现代码:#include#includeusing namespace std;void setMatricZero(vector > &matrix){ ....
分类:编程语言   时间:2014-12-03 20:51:24    阅读次数:157
careercup-1.6
1.6 给定一幅由N*N矩阵表示的如下,其中每个像素的大小为4个字节,编写一个方法,将图像选择90度。不占用额外内存空间能否做到?思路: 我们这里以逆时针旋转为例(写代码时比较容易理解,顺时针旋转的实现思想相似),可以先将原矩阵以主对角线为对称轴,交换主对角线两侧的的元素,得到新的矩阵(如果是顺时....
分类:其他好文   时间:2014-12-03 19:01:56    阅读次数:148
careercup-1.5
1.5 利用字符重复出现的次数,编写一个方法,实现基本的字符串压缩功能。比如,字符串”aabcccccaaa“会变成”a2b1c5a3“。若”压缩“后的字符串没有变短,则返回原先的字符串。类似 leetcode中解法:Count and say.C++实现代码:#include#includeusi...
分类:其他好文   时间:2014-12-03 18:46:50    阅读次数:171
careercup-1.4
1.4 编写一个方法,将字符串中的空格全部替换为“%20“。假定该字符串尾部有足够的空间存放新增字符,并且知道字符串的”真实“长度。C++实现代码:#include#include#includeusing namespace std;string replacespace(string str){...
分类:其他好文   时间:2014-12-03 17:04:37    阅读次数:134
careercup-1.2
1.2 用C或C++实现void reverse(char *str)函数,即反转一个null结尾的字符串。C++实现代码:#include#includeusing namespace std;/*反转字符串*/void reverse(char *str){ if(!str) ...
分类:其他好文   时间:2014-12-03 13:53:22    阅读次数:155
careercup-1.1
1.1 实现一个算法,确定一个字符串的所有字符是否全部不同。假设不允许使用额外的数据结构,又该如何处理?C++实现:#include#include#includeusing namespace std;/*判断是否有重复字符*/bool unqString(string s){ if(s.e...
分类:其他好文   时间:2014-12-03 12:19:39    阅读次数:124
Careercup | Chapter 8
8.2Imagine you have a call center with three levels of employees: respondent, manager, and director. An incoming telephone call must be first allocate...
分类:其他好文   时间:2014-11-04 22:30:06    阅读次数:246
CareerCup Chapter 4 Trees and Graphs
struct TreeNode{ int val; TreeNode* left; TreeNode* right; TreeNode(int val):val(val),left(NULL),right(NULL){}};Not all binary trees are bina...
分类:其他好文   时间:2014-10-07 15:02:23    阅读次数:221
Careercup | Chapter 7
7.4Write methods to implement the multiply, subtract, and divide operations for integers. Use only the add operator.比较简单。但是要封装得好。7.5 Given two squares...
分类:其他好文   时间:2014-09-14 11:17:07    阅读次数:189
CareerCup Facebook Total number of substring palindrome
Write a function for retrieving the total number of substring palindromes.  For example the input is 'abba' then the possible palindromes= a, b, b, a, bb, abba  So the result is 6.  Updated at 11...
分类:其他好文   时间:2014-06-21 23:59:42    阅读次数:422
212条   上一页 1 ... 17 18 19 20 21 22 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!