
LeetCode题目解答
「已注销」
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
LeetCode题目195-Bash解答
题目:给定一个文本文件 file.txt,请只打印这个文件中的第十行。示例:假设 file.txt 有如下内容:Line 1Line 2Line 3Line 4Line 5Line 6Line 7Line 8Line 9Line 10你的脚本应当显示第十行:Line 10解答:# Read from the file file.txt and output ...原创 2019-07-13 11:04:20 · 170 阅读 · 0 评论 -
LeetCode题目193-Bash解答
题目:给定一个包含电话号码列表(一行一个电话号码)的文本文件 file.txt,写一个 bash 脚本输出所有有效的电话号码。你可以假设一个有效的电话号码必须满足以下两种格式: (xxx) xxx-xxxx 或 xxx-xxx-xxxx。(x 表示一个数字)你也可以假设每行前后没有多余的空格字符。示例:假设 file.txt 内容如下:987-123-4567123 456 7890...原创 2019-07-13 17:52:19 · 218 阅读 · 0 评论 -
LeetCode题目194-Bash解答
题目:给定一个文件 file.txt,转置它的内容。你可以假设每行列数相同,并且每个字段由 ’ ’ 分隔.示例:假设 file.txt 文件内容如下:name agealice 21ryan 30应当输出:name alice ryanage 21 30解答:# Read from the file file.txt and print its transposed c...原创 2019-07-13 17:58:25 · 157 阅读 · 0 评论 -
LeetCode题目192-Bash解答
题目:写一个 bash 脚本以统计一个文本文件 words.txt 中每个单词出现的频率。为了简单起见,你可以假设:words.txt只包括小写字母和 ’ ’ 。每个单词只由小写字母组成。单词间由一个或多个空格字符分隔。示例:假设 words.txt 内容如下:the day is sunny the thethe sunny is is你的脚本应当输出(以词频降序排列)...原创 2019-07-13 18:07:17 · 163 阅读 · 0 评论 -
LeetCode题目1-C解答
题目:给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。你可以假设每种输入只会对应一个答案。但是,你不能重复利用这个数组中同样的元素。示例:给定 nums = [2, 7, 11, 15], target = 9因为 nums[0] + nums[1] = 2 + 7 = 9所以返回 [0, 1]解答:/...原创 2019-07-15 19:27:35 · 163 阅读 · 0 评论