09 2017 档案
摘要:const限定符 因为const对象一旦创建后其值就不能再改变,因此const对象必须初始化。 如果利用一个对象初始化另外一个对象,则它们是不是const都无关紧要。 通过以上初始化操作可知:const的常量特征仅仅在执行改变其值的操作时才会发挥作用。 默认情况下,const对象被设定为仅在文件内有
阅读全文
摘要:You are given a data structure of employee information, which includes the employee's unique id, his importance value and his direct subordinates' id.
阅读全文
摘要:You're now a baseball game point recorder. Given a list of strings, each string can be one of the 4 following types: Integer (one round's score): Dire
阅读全文
摘要:shell script 是利用 shell 的功能所写的一个“程序 (program)”,这个程序是使用纯文本文件,将一些 shell 的语法与指令(含外部指令)写在里面, 搭配正则表达式、管线命令与数据流重导向等功能,以达到我们所想要的处理目的 shell script 用在系统管理上面是很好的
阅读全文
摘要:正则表达式就是处理字串的方法,他是以行为单位来进行字串的处理行为 正则表达式通过一些特殊符号的辅助,可以让使用者轻易的达到“搜寻/删除/取代”某特定字串的处理程序 只要工具程序支持正则表达式,那么该工具程序就可以用来作为正则表达式的字串处理之用 正则表达式与万用字符是完全不一样的东西!万用字符 (w
阅读全文
摘要:由于核心在内存中是受保护的区块,因此我们必须要通过“ Shell ”将我们输入的指令与 Kernel 沟通,好让 Kernel 可以控制硬件来正确无误的工作 学习shell 的原因主要有:命令行的 shell 在各大 distribution 都一样;远端管理时命令行速度较快; shell 是管理
阅读全文
摘要:Linux下面的配置文件多为文本文件,故使用 vim 即可进行设置编辑 vim 可视为程序编辑器,可用以编辑 shell script, 配置文件等,避免打错字 vi 为所有 unix like 的操作系统都会存在的编辑器,且执行速度快速 vi 有三种模式,一般指令模式可变换到编辑与命令行界面,但编
阅读全文
摘要:重点 压缩指令为通过一些运算方法去将原本的文件进行压缩,以减少文件所占用的磁盘容量。 压缩前与压缩后的文件所占用的磁盘容量比值, 就可以被称为是“压缩比” 压缩的好处是可以减少磁盘容量的浪费,在 WWW 网站也可以利用文件压缩的技术来进行数据的传送,好让网站带宽的可利用率上升 压缩文件的扩展名大多是
阅读全文
摘要:正则表达式符号表示 意义:待搜寻的字符串word在行首 范例:搜寻行首为#开始的那一行,并列出行号 grep -n '^#' a.txt 意义:带搜寻的字符串word在行尾 范例:将行尾为!的那一行打印出来,并列出行号 grep -n '!$' a.txt 意义:代表【一定有一个任意字符】的字符 范
阅读全文
摘要:Given an input string, reverse the string word by word. For example,Given s = "the sky is blue",return "blue is sky the". Update (2015-02-12):For C pr
阅读全文
摘要:Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 Note:The input is assumed to be a 32-bit signed integer. Yo
阅读全文
摘要:Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. Not
阅读全文
摘要:给定一个字符串,要求把字符串前面的若干字符移动到字符串尾部。 解法一:蛮力法 首先想考虑将一个字符移到尾部的方法。代码如下: 如果要移动m个字符串,则依次对函数LeftShiftOne执行m次即可。代码如下: 时间复杂度:将一个字符移动到尾部需要n次操作,如果要移动m个字符,则需要操作m * n次。
阅读全文
摘要:Given a collection of distinct numbers, return all possible permutations. For example,[1,2,3] have the following permutations: 写出给定数组的全排列。使用递归的思想 思路:将
阅读全文
摘要:Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Return [1,3,3,1]. Note:Could you optimize your algorithm to us
阅读全文
摘要:Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the dept
阅读全文
摘要:Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred element) in the given BST. Assume a BST is define
阅读全文
摘要:Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may a
阅读全文
摘要:Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have ex
阅读全文
摘要:Given a non-empty special binary tree consisting of nodes with the non-negative value, where each node in this tree has exactly two or zero sub-node.
阅读全文
摘要:Given a 2D integer matrix M representing the gray scale of an image, you need to design a smoother to make the gray scale of each cell becomes the ave
阅读全文
摘要:问题:将一个n元一维向量向左旋转i个位置。例如,当n=8且i=3时,向量abcdefgh旋转为defghabc。简单的代码使用一个n元中间量在n步内完成该工作,你能否仅使用数十个额外字节的存储空间,在正比于n的时间内完成向量的旋转? Brute Algorithm:将需要移动的字符串x前i个元素复制
阅读全文
摘要:Given an unsorted array of integers, find the length of longest continuous increasing subsequence. Example 1: Example 2: Note: Length of the array wil
阅读全文
摘要:Given a binary tree, return the preorder traversal of its nodes' values. For example:Given binary tree {1,#,2,3}, return [1,2,3]. 递归 迭代
阅读全文
摘要:Given a binary tree, return the inorder traversal of its nodes' values. For example:Given binary tree [1,null,2,3], return [1,3,2]. 递归 迭代
阅读全文
摘要:Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target. E
阅读全文
摘要:Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its elements lies in [L, R] (R >= L). You might
阅读全文
摘要:Initially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back to the or
阅读全文
摘要:重点 一个可以被挂载的数据通常称为“文件系统, filesystem”而不是分区 (partition) 基本上 Linux 的传统文件系统为 Ext2 ,该文件系统内的信息主要有: superblock:记录此 filesystem 的整体信息,包括inode/block的总量、使用量、剩余量,
阅读全文
摘要:重点: 绝对路径:“一定由根目录 / 写起”;相对路径:“不由 / 写起,而是由相对当前目录写起”; 特殊目录有:., …, -, ~, ~account需要注意; 与目录相关的指令有:cd, mkdir, rmdir, pwd 等重要指令; rmdir 仅能删除空目录,要删除非空目录需使用“ rm
阅读全文
摘要:重点 Linux的每个文件中,可分别给予使用者、群组与其他人三种身份个别的 rwx 权限; 群组最有用的功能之一,就是当你在团队开发资源的时候,且每个帐号都可以有多个群组的支持; 利用ls -l显示的文件属性中,第一个字段是文件的权限,共有十个位,第一个位是文件类型, 接下来三个为一组共三组,为使用
阅读全文
摘要:我们知道权限对于使用者帐号来说是非常重要的,因为他可以限制使用者能不能读取/创建/删除/修改文件或目录! 在这一章我们介绍了很多文件系统的管理指令,第五章则介绍了很多文件权限的意义。在这个小节当中, 我们就将这两者结合起来,说明一下什么指令在什么样的权限下才能够运行吧!^_^ 一、让使用者能进入某目
阅读全文
摘要:1. 首先在Linux虚拟机上安装ssh服务(以Ubuntu16.04 LTS为例)。 sudo apt-get install openssh-server 2. 测试ssh服务是否安装成功并且运行ssh sudo /etc/init.d/ssh start 3. 查看Linux的IP地址(ine
阅读全文

浙公网安备 33010602011771号