• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






canexjtuzju

记录
 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理
上一页 1 2 3 4 5 6 7 8 9 ··· 23 下一页

2014年9月10日

LeetCode--Next Permutation
摘要: (1)从后往前,找到a[i] &num) { 4 int end = num.size() - 1; 5 int povit = end; 6 while(povit > 0){ 7 if(num[povit] > num[po... 阅读全文
posted @ 2014-09-10 21:01 canexjtuzju 阅读(203) 评论(0) 推荐(0)
 
Linux--获取执行时间
摘要: 说明:在进行一些性能测试的时候,有时候我们希望能计算一个程序运行的时间,有时候可能会自己写一个shell脚本方便进行一些性能测试的控制(比如希望能运行N次取平均值等),总之,这其中有一个需求可能就是获取一个时间戳或时间差。1. Linux shell获取时间的相关命令time命令:获取一个程序的执行... 阅读全文
posted @ 2014-09-10 14:44 canexjtuzju 阅读(855) 评论(0) 推荐(0)
 

2014年9月9日

c++基础--c++默认生成的成员函数
摘要: class Empty{public: Empty(); // 缺省构造函数 Empty( const Empty& ); // 拷贝构造函数 ~Empty(); // 析构函数 Empty& operator=( const Empty& ); // 赋值运算符 Empty* ope... 阅读全文
posted @ 2014-09-09 16:27 canexjtuzju 阅读(367) 评论(0) 推荐(0)
 

2014年9月8日

LeetCode--Wrod Break
摘要: ---恢复内容开始--- 1 class Solution { 2 public: 3 bool wordBreak(string s, unordered_set &dict) { 4 int nsize=s.size(); 5 int i=0,j=0; 6... 阅读全文
posted @ 2014-09-08 21:14 canexjtuzju 阅读(126) 评论(0) 推荐(0)
 
LeetCode--Largest Rectangle in Histogram
摘要: ---恢复内容开始--- 1 class Solution { 2 public: 3 int largestRectangleArea(vector &height) { 4 int n = height.size(); 5 if(n == 0) 6 ... 阅读全文
posted @ 2014-09-08 20:56 canexjtuzju 阅读(121) 评论(0) 推荐(0)
 

2014年9月7日

LeetCode--Binary Tree Maximum Path Sum
摘要: 递归,dfs这里返回值是一个pair,first表示两个子树的不经过当前root的最大pathsum;second表示两个子树的,以root->left和root->right为路径起始节点的路径的最大值 1 /** 2 * Definition for binary tree 3 * stru... 阅读全文
posted @ 2014-09-07 18:55 canexjtuzju 阅读(142) 评论(0) 推荐(0)
 
LeetCode--Reorder List
摘要: (1)双指针(快慢):找到中节点(2)反转第一或者第二个链表(反转第一个后面合并完了还得再反转),所以建议反转第二个链表代码:暂时不贴了https://oj.leetcode.com/problems/reorder-list/ 阅读全文
posted @ 2014-09-07 15:34 canexjtuzju 阅读(124) 评论(0) 推荐(0)
 

2014年9月6日

LeetCode--Combination Sum
摘要: 由于需要就地保存清零信息,所以把信息保存在第一行和第一列 1 class Solution { 2 public: 3 void setZeroes(vector > &matrix) { 4 const int ROW = matrix.size(); 5 ... 阅读全文
posted @ 2014-09-06 23:31 canexjtuzju 阅读(145) 评论(0) 推荐(0)
 
LeetCode--Binary Tree Level Order Traversal
摘要: 用两个队列实现,交叉使用,达到判断层的目的 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right... 阅读全文
posted @ 2014-09-06 23:17 canexjtuzju 阅读(147) 评论(0) 推荐(0)
 

2014年9月4日

LeetCode--Plus One
摘要: 考查,最高位有进位 1 class Solution { 2 public: 3 vector plusOne(vector &digits) { 4 // IMPORTANT: Please reset any member data you declared, as 5 ... 阅读全文
posted @ 2014-09-04 22:33 canexjtuzju 阅读(128) 评论(0) 推荐(0)
 
上一页 1 2 3 4 5 6 7 8 9 ··· 23 下一页