上一页 1 2 3 4 5 6 7 8 ··· 14 下一页
摘要: 链表结点类型定义:1 class Node {2 public:3 int data = 0;4 Node *next = nullptr;5 6 Node(int d) {7 data = d;8 }9 };快行指针(runner)技巧:同时... 阅读全文
posted @ 2014-05-20 18:13 小菜刷题史 阅读(352) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree andsum =... 阅读全文
posted @ 2014-05-20 12:31 小菜刷题史 阅读(138) 评论(0) 推荐(0) 编辑
摘要: Given a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string.If the last word doe... 阅读全文
posted @ 2014-05-20 12:10 小菜刷题史 阅读(97) 评论(0) 推荐(0) 编辑
摘要: Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the origi... 阅读全文
posted @ 2014-05-20 11:51 小菜刷题史 阅读(135) 评论(0) 推荐(0) 编辑
摘要: list构造函数://default:list l; //空的list//fill:list l(n); //n个元素, 元素默认初始化list l(n, value); //n个元素值为value//range:list l(fir... 阅读全文
posted @ 2014-05-19 23:02 小菜刷题史 阅读(197) 评论(0) 推荐(0) 编辑
摘要: deque(double-endedqueue)构造函数://default:deque d; //空的vector//fill:deque d(n); //n个元素的deque,元素默认初始化deque d(n, value); //... 阅读全文
posted @ 2014-05-19 22:03 小菜刷题史 阅读(269) 评论(0) 推荐(0) 编辑
摘要: vector构造函数://default:vector v; //空的vector//fill:vector v(n); //n个元素的vector,元素默认初始化vector v(n, value); //n个元素值为value的v... 阅读全文
posted @ 2014-05-19 21:12 小菜刷题史 阅读(281) 评论(0) 推荐(0) 编辑
摘要: 1.1 实现一个算法,确定一个字符串的所有字符是否全都不同。不允许使用额外的数据结构。解答:这里假定字符集为ASCII码,可以与面试官沟通确认字符串使用的字符集。由于字符集是有限的,建立一个数组模拟的Hash表记录每个字符是否出现,线性扫描一次字符串即可,复杂度O(len(s)).如果字符集较大,需... 阅读全文
posted @ 2014-05-19 13:21 小菜刷题史 阅读(529) 评论(0) 推荐(0) 编辑
摘要: Problem Description 魔法师百小度也有遇到难题的时候—— 现在,百小度正在一个古老的石门面前,石门上有一段古老的魔法文字,读懂这种魔法文字需要耗费大量的能量和大量的脑力。 过了许久,百小度终于读懂魔法文字的含义:石门里面有一个石盘,魔法师需要通过魔法将这个石盘旋转X度,以使上... 阅读全文
posted @ 2014-05-16 19:51 小菜刷题史 阅读(388) 评论(0) 推荐(0) 编辑
摘要: 问题描述:超市有4种包装的鸡蛋,分别是3个一盒,6个一盒,9个一盒和20个一盒。问顾客要买N个鸡蛋时,所有的组合方案。(Morgen Stanley 2014 Intern).还有找零钱问题要求输出所有方案,也是一个意思。核心代码: 1 void BuyEggsCore(vector &coins,... 阅读全文
posted @ 2014-05-13 13:33 小菜刷题史 阅读(322) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 14 下一页