摘要:Linux系统中grep命令是一种强大的文本搜索工具,它能使用正则表达式搜索文本,并把匹配的行打印出来。grep全称是GlobalRegularExpressionPrint,表示全局正则表达式版本,它的使用权限是所有用户。grep的工作方式是这样的,它在一个或多个文件中搜索字符串模板。如果模板包括...
阅读全文
摘要:linux通配符:通配符是由shell处理的(不是由所涉及到命令语句处理的,其实我们在shell各个命令中也没有发现有这些通配符介绍), 它只会出现在 命令的“参数”里(它不用在 命令名称里, 也不用在 操作符上)。当shell在“参数”中遇到了通配符时,shell会将其当作路径或文件名去在磁盘上搜...
阅读全文
摘要:用途正则表达式貌似只有一种用途,那就是搜索。搜索一个给定字符串中一切复合你心中某种模式的子串。语法正则表达式是一种文本模式,包括普通字符(例如,a 到 z 之间的字母)和特殊字符(称为“元字符”)。模式描述在搜索文本时要匹配的一个或多个字符串。下表包含了元字符的完整列表以及它们在正则表达式上下文中的...
阅读全文
摘要:解决数独Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character '.'.You may assume that there will ...
阅读全文
摘要:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target valu...
阅读全文
摘要:1. 移动光标快捷键ctrl+f 向前移动一个字符ctrl+b 向后移动一个字符alt+f 向前移动一个单词alt+b 向后移动一个单词ctrl+a 移动到当前行首ctrl+e 移动到当前行尾ctrl+l 清屏,并在屏幕最上面开始一个新行2. 编辑命令行快捷键ctrl+d 删除当前的字符ctrl+t...
阅读全文
摘要:今天看到有个目录的权限是rwxrwxrwt 很惊讶这个t是什么,怎么不是x或者-呢?搜了下发现: 这个t代表是所谓的sticky bit。sticky bit: 该位可以理解为防删除位. 一个文件是否可以被某用户删除, 主要取决于该文件所属的组是否对该用户具有写权限. 如果没有写权限, 则这个目录下...
阅读全文
摘要:集中不等式是数学中的一类不等式,描述了一个随机变量是否集中在某个取值附近。例如大数定律说明了一系列独立同分布随机变量的平均值在概率上趋近于它们的数学期望,这表示随着变量数目增大,平均值会集中在数学期望附近马尔可夫不等式马尔可夫不等式给出了一个实值随机变量取值大于等于某个特定数值的概率的上限。设X是一...
阅读全文
摘要:Longest Valid ParenthesesGiven a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substr...
阅读全文
摘要:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possibl...
阅读全文
摘要:Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpo...
阅读全文
摘要:Implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding element....
阅读全文
摘要:The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font ...
阅读全文
摘要:最长回文子串:1. 暴力搜索 时间复杂度O(n^3)2. 动态规划dp[i][j] 表示子串s[i…j]是否是回文初始化:dp[i][i] = true (0 i) ? min(p[j], mx-i) : 0; while (cstr[i + p[i] + 1] == cs...
阅读全文
摘要:Problem 2 ---Add Two Numbers简单的模拟题。Problem 3 ---Longest Substring Without Repeating Characters题意: 给定一个字符串序列,找出最长无重复的子序列。如"abcabcbb"的最长不重复子序列为"abc"思路: ...
阅读全文