- 博客(6)
- 收藏
- 关注
原创 LeetCode-195-第十行
给定一个文本文件 file.txt,请只打印这个文件中的第十行。示例:假设 file.txt 有如下内容:Line 1Line 2Line 3Line 4Line 5Line 6Line 7Line 8Line 9Line 10你的脚本应当显示第十行:Line 10说明:如果文件少于十行,你应当输出什么?至少有三种不同的解法,请尝试尽可能多的方法来解题。...
2019-11-23 22:40:34
83
原创 LeetCode-193-有效电话号码
给定一个包含电话号码列表(一行一个电话号码)的文本文件 file.txt,写一个 bash 脚本输出所有有效的电话号码。你可以假设一个有效的电话号码必须满足以下两种格式: (xxx) xxx-xxxx 或 xxx-xxx-xxxx。(x 表示一个数字)你也可以假设每行前后没有多余的空格字符。示例:假设 file.txt 内容如下:987-123-4567123 456 7890(12...
2019-11-23 22:30:45
133
原创 LeetCode-192-Word Frequency
Write a bash script to calculate the frequency of each word in a text file words.txt.For simplicity sake, you may assume:words.txt contains only lowercase characters and space ’ ’ characters.Each ...
2019-11-23 22:15:26
106
原创 LeetCode-194-Transpose File
Given a text file file.txt, transpose its content.You may assume that each row has the same number of columns and each field is separated by the ’ ’ character.Example:If file.txt has the following ...
2019-11-23 22:05:50
87
原创 Horse-racing Duals
题目链接 HORSE-RACING DUALS思路:创建数组 array 并读取 Pi 值存储于其中更改 IFS 为换行符(’\n’)后, 使用 sort -n 对 array 进行排序, 结果存储到新的数组 sorted_array遍历 sorted_array, 依次比较"后一元素值与当前元素值的差值"的大小:定义最小值 minimum 为 sorted_array 最后一个元素...
2019-03-01 19:09:02
242
原创 MIME Type
# Auto-generated code below aims at helping you parse# the standard input according to the problem statement.# N: Number of elements which make up the association table.read -r N# Q: Number Q of ...
2019-02-24 23:44:22
136
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人