自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(220)
  • 收藏
  • 关注

原创 【英文】邮件中提醒对方查看附件的多种说法

写英语邮件时会提醒对方查看附件,平常一般用 “Please, find the attached file”,也可以加一些解释 “Please, find the attached file you requested yesterday.”还有很多其他说法:Please, find the attached file for better understanding.Please, find the attached file as per your request.Please, find th

2020-12-08 11:24:41 19143

原创 【lc刷题】179. Largest Number(sort)

179. Largest NumberGiven a list of non-negative integers nums, arrange them such that they form the largest number.Note: The result may be very large, so you need to return a string instead of an integer.Example 1:Input: nums = [10,2]Output: “210”Ex

2020-11-05 05:03:25 243

原创 【lc刷题】300/334/673/1626 关于特定子序列 (DP)

300. Longest Increasing Subsequence301. Increasing Triplet Subsequence302. Number of Longest Increasing Subsequence1626. Best Team With No Conflicts300class Solution: def lengthOfLIS(self, nums: List[int]) -> int: """ [4,10,4,3,

2020-10-23 04:59:12 303

原创 【MacOS】双击打开ipynb文件 —— Automator的使用

七步搞定!第一步:search Automator第二步:choose a type Application第三步:搜索 shell,pass input 改成 as arguments, 在框里粘贴下面的文本variable="'$1'"the_script='tell application "terminal" to do script "jupyter lab 'osascript -e "${the_script}${variable}\""第四步:Save,一个是取名儿,放到

2020-09-28 09:37:54 1128

原创 【Error】AttributeError: module ‘scipy.misc‘ has no attribute ‘logsumexp‘ 的解决办法

$ python -VPython 3.7.6需要用到scipy.misc.logsumexp(),但总是报错>>> xarray([[ 1., 10.], [ 2., 20.], [ 3., 30.]])>>> scipy.misc.logsumexp(x)Traceback (most recent call last): File "<stdin>", line 1, in <module>At

2020-09-26 21:57:59 559

原创 【Jupyter Notebook】slides演示小技巧

首先,装个插件:$ pip install rise这里的alt相当于mac里的option可能是系统字体大小设置的问题,用rise看slides字体有叠加现象,所以再介绍下传统流程观看slides用:$ jupyter nbconvert path-of-the-slide.ipynb --to slides --post serve此外,小技巧:除了打开anaconda的界面再点开jupyter notebook之外,我们可以直接用命令行:$ jupyter notebook

2020-09-05 05:08:52 952

原创 【shell】Tmux 快捷键入门

Tmux:终端复用器(terminal multiplexer)类似于screen需要安装:# Ubuntu/Debian$ sudo apt-get install tmux# CentOS/Fedora$ sudo yum install tmux# MacOS$ brew install tmux需要知道的构造:sessionwindowpanetmux expects you to know its keybindings, and they all have

2020-08-19 14:37:22 326

原创 【Shell】常用命令

分屏:command + d恢复分屏:command +shift + d扔幕后跑:&$ nohup sleep 200 &[2] 84552 nohup: no hang up 挂起忽略SIGHUP信号,& 使命令于后台执行,因此终端退出后命令仍旧执行例:当使用 $ kill -HUP %2不会被影响暂停(并放后台):control +Z拿到前台 fg : foreground放到后台自己玩 bg :background..

2020-08-19 13:03:35 165

原创 【lc刷题】1544. Make The String Great

Given a string s of lower and upper case English letters.A good string is a string which doesn’t have two adjacent characterss[i] and s[i + 1] where:0 <= i <= s.length - 2 s[i] is a lower-case letter and s[i + 1] is thesame letter but in upper-c.

2020-08-09 14:47:07 277

原创 【lc刷题】1545. Find Kth Bit in Nth Binary String

题目:Given two positive integers n and k, the binary string Sn is formed as follows:S1 = “0”Si = Si-1 + “1” + reverse(invert(Si-1)) for i > 1Where + denotes the concatenation operation, reverse(x) returns the reversed string x, and invert(x) inverts

2020-08-09 14:36:10 158

原创 【MACOS】Node.js 和nvm的安装以及初使用,解决nvm: command not found

开始学习node.js, 安装推荐nvm,用来控制不同版本切换。打开命令行,使用homebrew安装:$ brew install nvm 查看nvm指示内容$ brew info nvm 其中有个Caveats,打开/.bash_profile把后面给的这堆加进去。Add the following to /Users/xxx/.bash_profile or your desired shellconfiguration file: export NVM_DIR="$HOME/.

2020-08-03 23:52:11 837

原创 【HTML】小白笔记

问:What are the four attributes we want to include on every img element?答: src, alt, height, widthSrc is short for source, and links to the file.Alt provides an alternative text experience of the image.Height and width let the browser know how much sp

2020-07-29 04:51:07 99

原创 【Mac OS】如何退出terminal中正在进行的程序

terminal的测试,跑到一半发现了问题,想停下来,怎么办?$ python3 text.pyprocessing a...processing b...使用键盘control^ + \ 即可。$ python3 text.pyprocessing a...processing b...^\Quit: 3已退出~

2020-07-17 00:02:05 6744

原创 【Error】 json file 不能读取的解决办法 TypeError: Input string must be text, not bytes

最开始是用with open(path) as f: data = json.loads(f)然后报错TypeError: Input string must be text, not bytes尝试1,加上解码:with open(path, encoding='utf-8') as f: data = json.loads(f)仍报错TypeError: Input string must be text, not bytes尝试2,读取每行:with open(path, enc

2020-07-02 11:19:39 1589

原创 【Error】UnicodeEncodeError: ascii codec can‘t encode character 的解决办法

需要爬点资料,需要用python3的urllib.request.urlopen打开http://live.dbpedia.org/data/Pablo_Guzmán_(reporter).json, 然后报错,UnicodeEncodeError: 'ascii' codec can't encode character '\xe1' in position 20: ordinal not in range(128)问题是出在name“Pablo_Guzmán_(reporter)” ,里面含有 n

2020-06-13 11:50:16 2793 1

原创 【numpy】利用reshape把三维矩阵变成二维,如何flatten

goal:把(2, 3, 2)的matrix打平成(2, 3*2)的matriximport numpy as npx = np.arange(12).reshape((2, 3, 2))Out[44]: array([[[ 0, 1], [ 2, 3], [ 4, 5]], [[ 6, 7], [ 8, 9], [10, 11]]]) x = x.reshape(x.shape[0],-1

2020-05-15 04:38:07 11441 2

原创 怎么用numpy随机生成某个区间的数字

语法: numpy.random.random(size=None)默认的是 [0.0, 1.0)如果想要[a, b)区间,就用:(b - a) * random_sample() + a这样我们就能获得[a, b)区间的随机值啦。举例:>>> np.random.seed(2333)>>> np.random.random_sample()0...

2020-03-18 06:32:13 13009 1

原创 【MacOS】如何给Sublime Text设置快捷Alias 在terminal中使用命令行打开sublime

打开terminal,输入$ nano .bashrc也就是用nano打开.bashrc文件,在最后一行加上alias sublime='open -a /Applications/Sublime\ Text.app'然后,control+O 保存,enter确认,control+X退出还需要source一下file,才可以使用:$ source .bashrc这样就可以直接在...

2020-03-05 11:53:19 526

原创 【MacOS】Docker的安装和基本使用

1. 下载安装Docker Desktop for Mac双击下载好的Docker.dmg, 然后将图标拽到application里:如果没有账号,请先注册。会收到一封verify的邮件,点击之后login,输入账号和密码。2.使用打开terminal 查看我们的version:$ docker versionoutput:Client: Docker Engine - Com...

2020-03-05 05:14:50 698

原创 【pip install】ERROR: Cannot uninstall 'xx'. It is a distutils installed project 的解决办法

在使用pip install 时出现的问题:.... Attempting uninstall: llvmlite Found existing installation: llvmlite 0.23.1ERROR: Cannot uninstall 'llvmlite'. It is a distutils installed project and thus we cannot...

2020-03-05 04:03:38 9623 4

原创 【MAC OS】git clone或者push到private repository报错remote: Repository not found解决办法

clone到private repo的解决办法一:在https里面插入用户名和密码$ git clone https://[username]:[code]@github.com/XXX.git但是,push没有地方插,error:$ git pushremote: Repository not found.fatal: repository 'https://XXX.git/' ...

2020-01-26 10:34:25 2776

原创 【lc刷题】79 Word Search

Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically n...

2019-12-16 03:06:32 80

原创 python 操作符 or Operator 的返回值

or operaterBOOLEAN:LeftRightorTrueTrueTrueTrueFalseTrueFalseTrueTrueFalseFalseFalseTrue or True => TrueFalse or True => TrueTrue or False => TrueFalse or...

2019-10-20 01:01:38 504

原创 python while else与break的使用

参考看两个例子对比:#例一:在while中的breaknum_0 = 6num_1 = 1while num_1 <= 12: if num_1 == num_0: print("break the loop") break num_1 += 1 print("the num is now", num_1)else:...

2019-09-13 01:11:10 1440

原创 【lc刷题】56. 合并区间(154/300)

154/300合并区间给出一个区间的集合,请合并所有重叠的区间。 示例 1: 输入: [[1,3],[2,6],[8,10],[15,18]]输出: [[1,6],[8,10],[15,18]]解释: 区间 [1,3] 和 [2,6] 重叠, 将它们合并为 [1,6].示例 2: 输入: [[1,4],[4,5]]输出: [[1,5]]解...

2019-08-18 22:14:34 169

原创 【lc刷题】25. K 个一组翻转链表(153/300)

153/300K 个一组翻转链表 给你一个链表,每 k 个节点一组进行翻转,请你返回翻转后的链表。 k 是一个正整数,它的值小于或等于链表的长度。 如果节点总数不是 k 的整数倍,那么请将最后剩余的节点保持原有顺序。 示例 : 给定这个链表:1->2->3->4->5 当 k = 2 ...

2019-08-16 20:55:18 108

原创 【lc刷题】49. 字母异位词分组(152/300)

152/300字母异位词分组给定一个字符串数组,将字母异位词组合在一起。字母异位词指字母相同,但排列不同的字符串。 示例: 输入: [“eat”, “tea”, “tan”, “ate”, “nat”, “bat”],输出:[[“ate”,“eat”,“tea”],[“nat”,“tan”],[“bat”]]说明: 所有输入均为小写字...

2019-08-04 16:54:55 113

原创 【lc刷题】55/45 跳跃游戏/跳跃游戏 II(149-150/300)

149-150/300跳跃游戏给定一个非负整数数组,你最初位于数组的第一个位置。 数组中的每个元素代表你在该位置可以跳跃的最大长度。 判断你是否能够到达最后一个位置。 示例 1: 输入: [2,3,1,1,4]输出: true解释: 从位置 0 到 1 跳 1 步, 然后跳 3 步到达最后一个位置。示例 2: 输入...

2019-08-04 16:34:50 134

原创 【lc刷题】48 旋转图像(151/300)

旋转图像给定一个 n × n 的二维矩阵表示一个图像。 将图像顺时针旋转 90 度。 说明: 你必须在原地旋转图像,这意味着你需要直接修改输入的二维矩阵。请不要使用另一个矩阵来旋转图像。 示例 1: 给定 matrix =[[1,2,3],[4,5,6],[7,8,9]], 原地旋转输入矩阵,使其变...

2019-08-04 16:33:28 198

原创 【lc刷题】44 通配符匹配(148/300)

148/300通配符匹配给定一个字符串 (s) 和一个字符模式 § ,实现一个支持 ‘?’ 和 ‘’ 的通配符匹配。 ‘?’ 可以匹配任何单个字符。'’ 可以匹配任意字符串(包括空字符串)。两个字符串完全匹配才算匹配成功。 说明: s 可能为空,且只包含从 a-z 的小写字母。p 可能为空,且只包含从 a-z 的小写字母,以及字符 ? 和 。...

2019-08-03 14:30:16 175

原创 【lc刷题】41/268 缺失的第一个正数/缺失数字(146-147/300)

146/300缺失的第一个正数给定一个未排序的整数数组,找出其中没有出现的最小的正整数。 示例 1: 输入: [1,2,0]输出: 3示例 2: 输入: [3,4,-1,1]输出: 2示例 3: 输入: [7,8,9,11,12]输出: 1说明: 你的算法的时间复杂度应为O(n),并且只能使用常数级别的空间。...

2019-08-02 15:14:43 117

原创 【lc刷题】38 报数(145/300)

145/300报数报数序列是一个整数序列,按照其中的整数的顺序进行报数,得到下一个数。其前五项如下: 1. 12. 113. 214. 12115. 1112211 被读作 “one 1” (“一个一”) , 即 11。11 被读作 “two 1s” (“两个一”), 即 21。21 被读作 “one 2”, “on...

2019-08-01 17:21:36 129

原创 python itertools.groupby() 使用方法

itertools.groupby(iterable[, key])官网input:[k for k, g in groupby('AAAABBBCCDAABBB')] output:['A', 'B', 'C', 'D', 'A', 'B']input:[list(g) for k, g in groupby('AAAABBBCCD')]output:[['A', 'A', 'A',...

2019-08-01 15:23:06 6091

原创 【lc刷题】36/37 有效的数独/解数独(143-144/300)

143/300有效的数独判断一个 9x9 的数独是否有效。只需要根据以下规则,验证已经填入的数字是否有效即可。 数字 1-9 在每一行只能出现一次。数字 1-9 在每一列只能出现一次。数字 1-9 在每一个以粗实线分隔的 3x3 宫内只能出现一次。上图是一个部分填充的有效的数独。 数独部分空格内已填入了数字,空白格用 ‘.’ 表示。 示例 ...

2019-08-01 02:32:13 292

原创 【lc刷题】35/34 搜索插入位置/在排序数组中查找元素的第一个和最后一个位置(143-144/300)

143/300在排序数组中查找元素的第一个和最后一个位置 给定一个按照升序排列的整数数组 nums,和一个目标值 target。找出给定目标值在数组中的开始位置和结束位置。 你的算法时间复杂度必须是 O(log n) 级别。 如果数组中不存在目标值,返回 [-1, -1]。 示例 1: 输入: nums = [5,7,7,...

2019-07-30 21:35:28 171

原创 【lc刷题】32 最长有效括号(142/300)

最长有效括号给定一个只包含 ‘(’ 和 ‘)’ 的字符串,找出最长的包含有效括号的子串的长度。 示例 1: 输入: “(()”输出: 2解释: 最长有效括号子串为 “()” 示例 2:输入: “)()())”输出: 4解释: 最长有效括号子串为 “()()” 来源:力扣(LeetCode)链接:https://leetcod...

2019-07-30 16:47:02 184

原创 【lc刷题】31. 下一个排列(141/300)

141/300下一个排列实现获取下一个排列的函数,算法需要将给定数字序列重新排列成字典序中下一个更大的排列。 如果不存在下一个更大的排列,则将数字重新排列成最小的排列(即升序排列)。 必须原地修改,只允许使用额外常数空间。 以下是一些例子,输入位于左侧列,其相应输出位于右侧列。1,2,3 → 1,3,23,2,1 → 1,2,31,1,5 →...

2019-07-30 03:07:10 95

原创 【lc刷题】30 串联所有单词的子串(140/300)

串联所有单词的子串 给定一个字符串 s 和一些长度相同的单词 words。找出 s 中恰好可以由 words 中所有单词串联形成的子串的起始位置。 注意子串要与 words 中的单词完全匹配,中间不能有其他字符,但不需要考虑 words 中单词串联的顺序。 示例 1: 输入:s = “barfoothefoobarman”,words...

2019-07-29 15:36:13 132

原创 【lc刷题】28 实现strStr() (139/300)

139/300实现strStr() 实现 strStr() 函数。 给定一个 haystack 字符串和一个 needle 字符串,在 haystack 字符串中找出 needle 字符串出现的第一个位置 (从0开始)。如果不存在,则返回 -1。 示例 1: 输入: haystack = “hello”, needle = “ll”...

2019-07-28 13:27:58 206

原创 【lc刷题】6 Z 字形变换 (138/300)

138/300Z 字形变换将一个给定字符串根据给定的行数,以从上往下、从左到右进行 Z 字形排列。 比如输入字符串为 “LEETCODEISHIRING” 行数为 3 时,排列如下: L C I RE T O E S I I GE D H N之后,你的输出需要从左往右逐行读取,产生出一个新的字符串,比如:“LCIRETOESIIGE...

2019-07-27 22:52:21 194

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除