大道至简

人生苦短,我用Python.

Linux三剑客-sed

sed命令使用

1.什么是sed sed是一个流编辑器,它以行为单位处理文本,文本可以来自文件、标准输入等,sed将文本的一行存储到临时缓冲区,称为”模式空间”, 并使用sed命令对缓冲区内容进行操作,处理完成后将缓冲区内容通过终端显示,接着处理下一行,直到文件末尾,sed不会修改文本内容,除非使用-i参数或重定向存储输出。 2.参数及其含义 sed [-nefilr] [动作] ...

LeetCode-120. Triangle

LeetCode-120. Triangle

1、题目 Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the following triangle [ [2], [3,4],...

Linux创建特定用户运行应用程序

创建特定用户运行应用程序

1. 运行用户空间应用程序 我们知道Linxu分为内核态和用户态,用户态和内核态交互的桥梁就是shell,用户的应用程序通常运行在用户态,也就是用户空间,默认情况下,root用户拥有系统最高权限,很多时候我们在linux部署应用程序时,程序可能需要取得某些系统权限才能正常运行,比如在所属组为root的目录里新建一个*.pid文件,普通用户是没有权限的,所以我们一般直接使用root用户来运行...

LeetCode-516. Longest Palindromic Subsequence

LeetCode-516. Longest Palindromic Subsequence

1、题目 Given a string s, find the longest palindromic subsequence’s length in s. You may assume that the maximum length of s is 1000. Example 1: Input: "bbbab" Output: 4 One possible longest palin...

LeetCode-698. Partition to K Equal Sum Subsets

LeetCode-698. Partition to K Equal Sum Subsets

1、题目 Given an array of integers nums and a positive integer k, find whether it’s possible to divide this array into k non-empty subsets whose sums are all equal. Example 1: Input: nums = [4, 3, ...

LeetCode-1027. Longest Arithmetic Sequence

LeetCode-1027. Longest Arithmetic Sequence

1、题目 Given an array A of integers, return the length of the longest arithmetic subsequence in A. Recall that a subsequence of A is a list A[i_1], A[i_2], …, A[i_k] with 0 <= i_1 < i_2 < ...

LeetCode-673. Number of Longest Increasing Subsequence

LeetCode-673. Number of Longest Increasing Subsequence

1、题目 Given an unsorted array of integers, find the number of longest increasing subsequence. Example 1: Input: [1,3,5,4,7] Output: 2 Explanation: The two longest increasing subsequence are [1, 3,...

LeetCode-Bomb Enemy

LeetCode-Bomb Enemy

1、题目 有一个M*N的网格,每一个格子可能为空,可能有一个敌人,可能有一堵墙,空格子使用'0'表示,敌人用'E'表示,墙使用'W'表示. 只能在某个空格子里放一个炸弹,炸弹会炸死网格所在同行同列的敌人,但是不能穿透墙, 最多能炸死多人敌人? 2、思路 这是一道坐标型动态规划的题,我们可以按照下面四步来分析: 2.1、确定状态 首先分析一个方向(向上) 假设在网格的每一个格子都可...

LeetCode-931. Minimum Falling Path Sum

LeetCode-931. Minimum Falling Path Sum

1、题目 Given a square array of integers A, we want the minimum sum of a falling path through A. A falling path starts at any element in the first row, and chooses one element from each row. The ne...

动态规划-Coin Change

Coin Change

1、题目 You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount ...

< script src = " / js / bootstrap.min.js " >