すべての出会いが美しいとは限らない。すべての別れが悲しいとは言えない。

0%

Quick Start

According to the official document of NexT, we can implement the customization of NexT by theme_inject. This blog will talk about how to customize your NexT with the config and create your own inject step by step as well.

Using Injects

custom_file_path

First, uncomment the code in the themes/next/_config.yml( If you are using the submodule and CI tool metioned in the previous blog, please remember to change the deploy/_config.yml as well). NexT has already created the 10 injection points as following. Of cause, you can change the path here to your own customized path.

Read more »

Quick Start

In the last blog 【Hexo】Part 1. How to Setup Blog with Hexo and NexT on GitHub Pages, we learned how to setup up a blog web with Hexo and deploy it from local to GitHub Pages.

In this blog, it will talk about how to deploy you blog automatically with the CI tool Github Action.

Prepare the Config File of the Theme

As metioned in the last blog, we are now using the github submodule to manage the theme NexT. The submodule can be initialized on Github Action with command git submodule update --init. However, we will lose the changes we have made in the config file themes/next/_config.yml. There are several ways to resolve this:

  • Fork the NexT in our repository and commit the changes of the config. But we will need to do something more when NexT is updated.
  • Copy all the things into the main config file _config.yml. This will make the _config.yml a little confusing.
  • Backup the config file in the main repository and overwrite the original one in the Github Action.
Read more »

Description

https://leetcode.com/problems/merge-sorted-array/

1
2
3
4
5
6
7
8
9
10
11
12
13
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.

Note:

The number of elements initialized in nums1 and nums2 are m and n respectively.
You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold additional elements from nums2.
Example:

Input:
nums1 = [1,2,3,0,0,0], m = 3
nums2 = [2,5,6], n = 3

Output: [1,2,2,3,5,6]
Read more »

Description

https://leetcode.com/problems/valid-sudoku/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Determine if a 9x9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules:

Each row must contain the digits 1-9 without repetition.
Each column must contain the digits 1-9 without repetition.
Each of the 9 3x3 sub-boxes of the grid must contain the digits 1-9 without repetition.

A partially filled sudoku which is valid.

The Sudoku board could be partially filled, where empty cells are filled with the character '.'.

Example 1:

Input:
[
["5","3",".",".","7",".",".",".","."],
["6",".",".","1","9","5",".",".","."],
[".","9","8",".",".",".",".","6","."],
["8",".",".",".","6",".",".",".","3"],
["4",".",".","8",".","3",".",".","1"],
["7",".",".",".","2",".",".",".","6"],
[".","6",".",".",".",".","2","8","."],
[".",".",".","4","1","9",".",".","5"],
[".",".",".",".","8",".",".","7","9"]
]
Output: true
Example 2:

Input:
[
["8","3",".",".","7",".",".",".","."],
["6",".",".","1","9","5",".",".","."],
[".","9","8",".",".",".",".","6","."],
["8",".",".",".","6",".",".",".","3"],
["4",".",".","8",".","3",".",".","1"],
["7",".",".",".","2",".",".",".","6"],
[".","6",".",".",".",".","2","8","."],
[".",".",".","4","1","9",".",".","5"],
[".",".",".",".","8",".",".","7","9"]
]
Output: false
Explanation: Same as Example 1, except with the 5 in the top left corner being
modified to 8. Since there are two 8's in the top left 3x3 sub-box, it is invalid.
Note:

A Sudoku board (partially filled) could be valid but is not necessarily solvable.
Only the filled cells need to be validated according to the mentioned rules.
The given board contain only digits 1-9 and the character '.'.
The given board size is always 9x9.
Read more »

Description

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Given two integers dividend and divisor, divide two integers without using multiplication, division and mod operator.

Return the quotient after dividing dividend by divisor.

The integer division should truncate toward zero.

Example 1:

Input: dividend = 10, divisor = 3
Output: 3
Example 2:

Input: dividend = 7, divisor = -3
Output: -2
Note:

Both dividend and divisor will be 32-bit signed integers.
The divisor will never be 0.
Assume we are dealing with an environment which could only store integers within the 32-bit signed integer range: [−231, 231 − 1]. For the purpose of this problem, assume that your function returns 231 − 1 when the division result overflows.
Read more »

Description

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.

Example 1:

Input: num1 = "2", num2 = "3"
Output: "6"
Example 2:

Input: num1 = "123", num2 = "456"
Output: "56088"
Note:

The length of both num1 and num2 is < 110.
Both num1 and num2 contain only digits 0-9.
Both num1 and num2 do not contain any leading zero, except the number 0 itself.
You must not use any built-in BigInteger library or convert the inputs to integer directly.
Read more »

Overview

Sort Algorithms Time Complexity(AVG) Time Complexity(WST) Time Complexity(BST) Space Complexity Stable
Insert $O(n^2)$ $O(n^2)$ $O(n)$ $O(1)$
Selection $O(n^2)$ $O(n^2)$ $O(n^2)$ $O(1)$ ×
Heap $O(n\log{}n)$ $O(n\log{}n)$ $O(n\log{})$ $O(1)$ ×
Bunble $O(n^2)$ $O(n^2)$ $O(n)$ $O(1)$
Quick $O(n\log{}n)$ $O(n^2)$ $O(n\log{}n)$ $O(\log{}n)$ ×
Merge $O(n\log{}n)$ $O(n\log{}n)$ $O(n\log{}n)$ $O(n)$

Description

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).

For example, this binary tree [1,2,2,3,4,4,3] is symmetric:

1
/ \
2 2
/ \ / \
3 4 4 3
But the following [1,2,2,null,3,null,3] is not:

1
/ \
2 2
\ \
3 3
Note:
Bonus points if you could solve it both recursively and iteratively.
Read more »