0%

Java learning Experience

I am learning Java right now, so I will keep updating my status about java.

I like Java, believe it or not, the JVM is so amazing, this artcile will not cover knowledge about java, just some learing experience.

I want to recommand you some wonderful tools for Mac.

  1. VS code, it is an excellent editor for all programming, you are see, it has command line and easy to debug. I will have a future article takes about vs code more, and shortcut of it.

  2. Keka is an uncompress or compress application, so amazing.

  3. IINA is a multiple support player,you can play avi, mp4, etc. Almost everything, it has poweful function, like 16 times speed.

  4. Intellij IDEA, a java idle, very powerful, i will have a eesay about shortcut and introduction for this in the future.

  5. Dash, the best tools, it has almost all the api files of all programming language, so good to use it.

  6. VM fusion, the virtual machine, it is so stable, although it have some bug in it, like offnetwork sometime, but when you face this, restart your laptop, it works for most time.

    Keep update in the future.

This is a easy way to learn Dynamic Programming

DP is known as bottom-up and top-down.
Top-down is like a recursion, but with memoized, when using top-down, draw tree.
Bottom-up is like careful brute force, you need to track all the subquestions’ answer for further use.

This is a picture from MIT course that explain the fib questions use bottom-up, I actually like bottom-up way, because it is easy to understand, you need to draw a table to find the optimal solution, although you can use it for fib one.

Here are some dp classic questions.

1. *Find a Path***

Leetcode 62. Unique Paths

A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below).

The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked ‘Finish’ in the diagram below).

How many possible unique paths are there?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
class Solution {
public int uniquePaths(int m, int n) {
int[][] nums =new int[m][n];
for(int[] b: nums ){
Arrays.fill(b, 1);
}
for(int i=1; i< m; i++){
for(int j=1;j<n;j++){
nums[i][j]=nums[i-1][j]+nums[i][j-1];
}
}
return nums[m-1][n-1];
}
}

63.*Unique Paths II***

robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below).

The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked ‘Finish’ in the diagram below).

Now consider if some obstacles are added to the grids. How many unique paths would there be?

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
class Solution {
public int uniquePathsWithObstacles(int[][] obstacleGrid) {
int row=obstacleGrid.length;
int col=obstacleGrid[0].length;
if(obstacleGrid[0][0]==1){
return 0;
}
obstacleGrid[0][0]=1;
for(int i=1;i<row;i++){
obstacleGrid[i][0]=(obstacleGrid[i][0]==0 && obstacleGrid[i-1][0]==1)? 1:0;
}
for(int j=1;j<col;j++){
obstacleGrid[0][j]=(obstacleGrid[0][j]==0 && obstacleGrid[0][j-1]==1)? 1:0;
}
for(int i=1;i<row;i++){
for(int j=1;j<col;j++){
if(obstacleGrid[i][j]==0){
obstacleGrid[i][j]=obstacleGrid[i-1][j]+obstacleGrid[i][j-1];
}
else{
obstacleGrid[i][j]=0;
}
}
}
return obstacleGrid[row-1][col-1];
}
}

Commands

init

1
$ hexo init [folder]

Initializes a website. If no folder is provided, Hexo will set up the website in the current directory.

new

1
$ hexo new [layout] <title>

Creates a new article. If no layout is provided, Hexo will use the default_layout from _config.yml. If the title contains spaces, surround it with quotation marks.

Option Description
-p, --path Post path. Customize the path of the post.
-r, --replace Replace the current post if existed.
-s, --slug Post slug. Customize the URL of the post.

By default, Hexo will use the title to define the path of the file. For pages, it will create a directory of that name and an index.md file in it. Use the --path option to override that behaviour and define the file path:

1
hexo new page --path about/me "About me"

will create source/about/me.md file with the title “About me” set in the front matter.

Please note that the title is mandatory. For example, this will not result in the behaviour you might expect:

1
hexo new page --path about/me

will create the post source/_posts/about/me.md with the title “page” in the front matter. This is because there is only one argument (page) and the default layout is post.

generate

1
$ hexo generate

Generates static files.

Option Description
-d, --deploy Deploy after generation finishes
-w, --watch Watch file changes
-b, --bail Raise an error if any unhandled exception is thrown during generation
-f, --force Force regenerate
-c, --concurrency Maximum number of files to be generated in parallel. Default is infinity

publish

1
$ hexo publish [layout] <filename>

Publishes a draft.

server

1
$ hexo server

Starts a local server. By default, this is at http://localhost:4000/.

Option Description
-p, --port Override default port
-s, --static Only serve static files
-l, --log Enable logger. Override logger format.

deploy

1
$ hexo deploy

Deploys your website.

Option Description
-g, --generate Generate before deployment

render

1
$ hexo render <file1> [file2] ...

Renders files.

Option Description
-o, --output Output destination

migrate

1
$ hexo migrate <type>

Migrates content from other blog systems.

clean

1
$ hexo clean

Cleans the cache file (db.json) and generated files (public).

list

1
$ hexo list <type>

Lists all routes.

version

1
$ hexo version

Displays version information.

Options

Safe mode

1
$ hexo --safe

Disables loading plugins and scripts. Try this if you encounter problems after installing a new plugin.

Debug mode

1
$ hexo --debug

Logs verbose messages to the terminal and to debug.log. Try this if you encounter any problems with Hexo. If you see errors, please raise a GitHub issue.

Silent mode

1
$ hexo --silent

Silences output to the terminal.

Customize config file path

1
$ hexo --config custom.yml

Uses a custom config file (instead of _config.yml). Also accepts a comma-separated list (no spaces) of JSON or YAML config files that will combine the files into a single _multiconfig.yml.

1
$ hexo --config custom.yml,custom2.json

Display drafts

1
$ hexo --draft

Displays draft posts (stored in the source/_drafts folder).

Customize CWD

1
$ hexo --cwd /path/to/cwd

Customizes the path of current working directory.

Computer Science website

黑马程序员

b站

免费下载youtube

slader查课本答案

youtube

Python官方文档

电子书免费下载

知乎

酷壳博客学内核

java技术驿站

免费下载英文计算机pdf

免费练打字

java在线课程

动力节点所有课链接

LeetCode

人工智能自学

百度

菜鸟教程

GRE考满分

GRE雷哥

github

鸠摩搜书免费搜书

知乎java讲解

下载b站视频网站youtube也可以