面试题
17ning
感谢您强迫我进步
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
《剑指offer》面试题4(合并数组)
#include using namespace std; void mergeArray(int *A1,int& length1, int*A2, int length2)//把A2合并到A1中,假设A1,A2中的元素是从小到大 { if(A1==NULL || A2==NULL || length1<0 || length2<0) return; int p1 = len原创 2014-06-02 19:13:36 · 593 阅读 · 0 评论 -
《剑指offer》链表的结点的插入删除
#include #include using namespace std; struct ListNode { int value; struct ListNode* next; }; void addToTail(ListNode** pHead,int value) { if(pHead == NULL) return; ListNode* pNew =原创 2014-06-02 19:15:47 · 674 阅读 · 0 评论 -
《剑指offer》面试题4(替换空格)
#include #include #include using namespace std; void replaceBlank(char* str); int main() { char* str; str = new char[100]; strcpy(str," str str "); replaceBlank(str); cout<<s原创 2014-06-02 19:14:53 · 586 阅读 · 0 评论 -
《剑指offer》面试题3
#include #include using namespace std; struct Point //点结构体 { int x,y; Point(int dx=0,int dy=0): x(dx),y(dy) {} bool operator<=(Point b) const { return x<=b.x &&原创 2014-06-02 09:59:10 · 547 阅读 · 0 评论 -
《剑指offer》面试题10(二进制中1的个数)
#include using namespace std; int numberOf1(int n) { int cnt=0; while(n) { n=n&(n-1); //把n的二进制中最低位的1变为0 cnt++; } return cnt; } int main() { cout<<numberOf1(8)原创 2014-06-04 20:31:18 · 495 阅读 · 0 评论 -
面试题40(数组中出现一次的数字)
#include using namespace std; const int maxn = 100; int a[maxn]; void findNumberAppearOnce(int* data, int length, int* num1, int*num2) { if(data == NULL || length<2) return; int resultExclus原创 2014-06-04 20:33:15 · 422 阅读 · 0 评论 -
编写String类的构造函数,析构函数,赋值运算符
class String { private: char* m_data; public: String(const char* str=NULL); String(const String&); ~String(); String& operator=(const String&); } String::String(const char* str) { if(str == NULL原创 2014-05-27 21:36:44 · 497 阅读 · 0 评论 -
《剑指offer》面试题3(2)
#include #include using namespace std; const int maxn = 100; int a[maxn*maxn],n,m; bool isInArray(int* matrix, int rows, int columns, int number); int main() { while(true) { scanf("%原创 2014-06-02 19:10:56 · 646 阅读 · 0 评论 -
it智力题
1、假设你站在镜子前,抬起左手,抬起右手,看看镜中的自己。当你抬起左手时,镜中的自己抬起的似乎是右手。可是当你仰头时,镜中的自己也在仰头,而不是低头。为什么镜子中的影像似乎颠倒了左右,却没有颠倒上下? 答:上下和左右的定义不同,上下是面对称的,左右是旋转对称的 (如果两只眼睛是长成一上一下就好了) 2、有50家人家,每家一条狗。有一天警察通知,50条狗当中有病狗,行为和正常狗不一样。每人只转载 2014-10-22 09:51:09 · 443 阅读 · 0 评论
分享