摘要:
#### 算数运算 ```lua Set = {} function Set.union(a, b) local res = Set.new{} for k in pairs(a) do res[k] = true end for k in pairs(b) do res[k] = true end 阅读全文
摘要:
查看clang++搜索路径 clang++ -E -x c++ - -v < /dev/null 阅读全文
摘要:
32. Longest Valid Parentheses 最长有效括号 题目描述 Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed 阅读全文
摘要:
KMP算法 理解 KMP算法的核心,是一个被称为部分匹配表(Partial Match Table)的数组。我觉得理解KMP的最大障碍就是很多人在看了很多关于KMP的文章之后,仍然搞不懂PMT中的值代表了什么意思。这里我们抛开所有的枝枝蔓蔓,先来解释一下这个数据到底是什么。 对于字符串“ababab 阅读全文
摘要:
55. 跳跃游戏 能跳一个范围,贪心 class Solution { public: bool canJump(vector<int>& nums) { int m = 0; //每次拓展最右端点,大于nums.size()-1时返回 for(int i = 0; i < nums.size() 阅读全文
摘要:
模板 void dfs()//参数用来表示状态 { if(到达终点状态) { ...//根据题意添加 return; } if(越界或者是不合法状态) return; if(特殊状态)//剪枝 return ; for(扩展方式) { if(扩展方式所达到状态合法) { 修改操作;//根据题意来添加 阅读全文
摘要:
https://www.bilibili.com/video/BV1Z4411x7Kw?from=search&seid=13855865082722302053 状压介绍: 状态表示: 转移方程:i是当前节点,j是下一步要走的节点 子集枚举: 核心代码:1。由当前枚举未知 首先枚举状态,枚举S中包 阅读全文
摘要:
c语言详解sizeof 原文地址:http://blog.sina.com.cn/s/blog_5da08c340100bmwu.html 一、sizeof的概念 sizeof是C语言的一种单目操作符,如C语言的其他操作符++、--等。 它并不是函数。 sizeof操作符以字节形式给出了其操作数的存 阅读全文
摘要:
快速排序: void QuickSort(vector<int>& nums, int lo, int hi){ if(lo < hi){ int p = partition(nums,lo,hi); QuickSort(nums,lo,p-1); QuickSort(nums,p+1,hi); } 阅读全文