Algorithm--Coin Change
Dynamic ProgrammingCoin ChangeTitle Detail
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 of money cannot be made up by any combination of the coins, return -1.
Example 1:123Input: coins = [1, 2, 5], amount = 11Output: 3 Explanation: 11 = 5 + 5 + 1Example 1:12Input: coins = [2], amount = 3Output: -1Note:
You may assume that you have an infinite number o ...
Algorithm--Sqrt(x)
Some Algorithm using Math AlgorithmAlgorithm-1 Sqrt(x)Title detail
Implement int sqrt(int x)Compute and return the square root of x, where x is guaranteed to be a non-negative integer.
Since the return type is an integer, the decimal digits are truncated and only the integer part of the result is returned.
Example 1:12Input: 4Output: 2Example 2:1234Input: 8Output: 2Explanation: The square root of 8 is 2.82842..., and since the decimal part is truncated, 2 is returned.
思路
牛顿迭代法
公式: ...
Algortthm--Jewels and Stones
Map的应用Jewels and StonesTitle Detail
You’re given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how many of the stones you have are also jewels.
The letters in J are guaranteed distinct, and all characters in J and S are letters. Letters are case sensitive, so “a” is considered a different type of stone from “A”.
Example 1:12Input: J = "aA", S = "aAAbbbb"O ...
Algorithm--Fast and Slow Pointer
快慢指针的应用判断链表是否存在环Title Detail
Given a linked list, determine if it has a cycle in it.
To represent a cycle in the given linked list, we use an integer pos which represents the position (0-indexed) in the linked list where tail connects to. If pos is -1, then there is no cycle in the linked list.
Example 1:
123Input: head = [3,2,0,-4], pos = 1Output: trueExplanation: There is a cycle in the linked list, where tail connects to the second node.
思路利用快慢指针,快指针每次走两步,慢指针每次走一步。如果快指针能够追上慢指针,则链 ...
Algorithm--Find Common Characters
Find Common CharactersTitle detail
Given an array A of strings made only from lowercase letters, return a list of all characters that show up in all strings within the list (including duplicates). For example, if a character occurs 3 times in all strings but not 4 times, you need to include that character three times in the final answer.
You may return the answer in any order.
Example 112Input: ["bella","label","roller"]Output: ["e","l","l& ...
在Linux系统中同步更新我们的Github博客
原理介绍类似于版本管理,我们把hexo博客文件系统在Github上建立一个分支,通过管理分支提交最新的博客文件系统,保证我们博客框架的更新。然后我们基于最新的博客框架,撰写文章,进行Github Pages网页的更新,即我们博客内容的更新。
创建两个分支,一个用于存放博客静态资源,一个用于备份博客的部署文件。
参考资料
前期准备
一台Linux系统的电脑(我的linux系统是Ubuntu 18.04.2 LTS)
安装node.js 及 npm
安装 ssh
安装 git
按照我们前面教程搭建好的博客
创建Github 博客仓库分支首先在我们搭建Hexo博客的电脑上,创建我们博客仓库在Github上的分支。
打开我们的博客仓库,选择setting:
选择Branches,创建博客仓库的Hexo分支,并将其设置为默认分支。
将该仓库克融到本地,并把本地博客的(所有Hexo目录下文件)全部拷贝进username.github.io文件目录中去。
然后把更新后的博客部署文件提交到Github的hexo分支中。
依次执行123git add .git commit ...
Markdown简单教程
Markdown语言简介Markdown是一种轻量级的「标记语言」,语法简单易于上手,2004年由John Gruber创建。Markdown通过纯文本编写的方式实现文章的撰写与排版,然后被转化为html或者pdf,可以轻松地将文章分享。相较于文本编辑器word的文章排版的方式,Markdown通过固定的文本格式实现了绝大多数的排版场景,让创作者可以专心于文章的构思于撰写,而从繁琐的排版工作中解脱出来。
Markdown书写工具Markdown也得到了广泛的支持,例如简书、github、知乎、博客园等等都支持直接上传Markdown文档,同时一些桌面程序也支持利用Markdown语法记录文章。推荐的Markdown文档工具如下:
Mac系统:Mou
Windows系统:MarkPad
Linux系统:retext
网页版:简书,可支持在线预览Markdown文档的功能
一些在线的Markdown工具:
MaHua在线编辑器,无须测试
Cmd Markdown客户端编译器
Markdown语法很多博客的文章也是用Markdown写成的,因此花几分钟学习Markdown的语法还是 ...
Windows环境下Hexo+Github搭建个人博客教程
前言你是否也想拥有属于自己的博客?是否也想拥有跟我一样的博客空间?如果心动了,就赶紧往下看吧!
教程炒鸡简单,炒鸡详细,而且博客搭建完全是Free of Charge!
原理Github PagesGithub不仅可以让我们把代码托管在平台上,而且允许我们利用Github的服务器部署自定义网页对我们的项目作简介。这个网页就被称为Github Pages。这是我们可以利用Github搭建免费博客的基础啦~
HexoHexo是一款轻量但高逼格的搭建博客快速工具,它是基于Node.js开发的。而Node.js…好了,扯远了…有兴趣的童鞋可以出门左转自己百度…
准备知道了大致的原理,我们首先需要准备搭建博客的材料。如下:
1. 一台windows系统的电脑2. 一个Github账号3. 安装Node.js4. 安装Git5. 安装Hexo
开始申请Github账号,建立一个仓库,并为此创建一个说明网页(Github Pages)假设我们都有了Github账号,这是首先在右上角点击“+”号,选择New repository
注意 仓库名一定是”你的Github用户名”+github.io ...
再见2018,你好2019!
这里有东西被加密了,需要输入密码查看哦。