2017年8月17日

两个整数相除

摘要: 代码: class Solution { public: / @param dividend the dividend @param divisor the divisor @return the result / int divide(int dividend, int divisor) { // 阅读全文

posted @ 2017-08-17 23:10 p666 阅读(212) 评论(0) 推荐(0) 编辑

合并K个排序链表

摘要: 代码: class Solution { public: ListNode mergeKLists(vector &lists) { if(lists.empty()) return nullptr; vector heap; for(int i = 0; i != lists.size(); i 阅读全文

posted @ 2017-08-17 23:08 p666 阅读(315) 评论(0) 推荐(0) 编辑

前序遍历和中序遍历树构造二叉树

摘要: 代码: / Definition of TreeNode: class TreeNode { public: int val; TreeNode left, right; TreeNode(int val) { this val = val; this left = this right = NUL 阅读全文

posted @ 2017-08-17 23:06 p666 阅读(100) 评论(0) 推荐(0) 编辑

解码方法

摘要: 代码: class Solution { public: / @param s a string, encoded message @return an integer, the number of ways decoding / int numDecodings(string& s) { if ( 阅读全文

posted @ 2017-08-17 23:04 p666 阅读(207) 评论(0) 推荐(0) 编辑

乘积最大子序列

摘要: 代码: class Solution { public: / @param nums: a vector of integers @return: an integer / int maxProduct(vector& nums) { // write your code here int posM 阅读全文

posted @ 2017-08-17 23:02 p666 阅读(116) 评论(0) 推荐(0) 编辑

在0(1)时间复杂度删除链表节点

摘要: 代码: class Solution { public: / @param node: a node in the list should be deleted @return: nothing / void deleteNode(ListNode node) { // write your cod 阅读全文

posted @ 2017-08-17 22:53 p666 阅读(177) 评论(0) 推荐(0) 编辑

左填充

摘要: 代码: class StringUtils { public: / @param originalStr the string we want to append to @param size the target length of the string @param padChar the ch 阅读全文

posted @ 2017-08-17 22:51 p666 阅读(102) 评论(0) 推荐(0) 编辑

爬楼梯

摘要: 代码: class Solution { public: / @param n: An integer @return: An integer / int climbStairs(int n) { // write your code here if(n == 1 || n ==0){ return 阅读全文

posted @ 2017-08-17 22:49 p666 阅读(95) 评论(0) 推荐(0) 编辑

比较字符串

摘要: 代码: class Solution { public: / @param A: A string includes Upper Case letters @param B: A string includes Upper Case letter @return: if string A conta 阅读全文

posted @ 2017-08-17 22:47 p666 阅读(128) 评论(0) 推荐(0) 编辑

1500802012 朋毛东知

摘要: 翻转链表 代码代码: / Definition of ListNode class ListNode { public: int val; ListNode next; ListNode(int val) { this val = val; this next = NULL; } } / class 阅读全文

posted @ 2017-08-17 22:15 p666 阅读(78) 评论(0) 推荐(0) 编辑

导航