ARTS Week 7

Algorithm

This week’s LeetCode problem is 237. Delete Node in a Linked List

Description: Write a function to delete a node in a singly-linked list. You will not be given access to the head of the list, instead you will be given access to the node to be deleted directly. It is guaranteed that the node to be deleted is not a tail node in the list.

Input: head = [4,5,1,9], node = 5 Output: [4,1,9]

Solution Idea: Because it is not possible to get the nodes before a given node, only the current node and the nodes after it. Therefore, we can change the value of the current node to the value of its next node, and then delete the node after it. The example is as follows.

Accepted Code

Review

This week’s Review is for the following article: Vim Anti-Patterns That Cause Beginners to :Quit

In the article, the author gives some suggestions to make it easier for beginners to get used to using vim, as follows:

  1. Don’t go all in. unlike VS Code, IDE, etc., you can’t master it right from the start, so after you install Vim, use it for 15–30 minutes a day, notice what features you think Vim lacks that you want, and write them down.
  2. Don’t be paralyzed by the variety of Vim. There are many Vim’s available: Native Vim, Neovim, GVim, Onivim, Spacevim, etc. The author recommends Neovim.
  3. Configure your own .vimrc: When you first start using Vim, you may use other people's configured Vim, but slowly you will find that other people's configuration files do not suit you, so you need to start building your own Vim configuration file (.vimrc). You'll get better and better at it.
  4. Vim provides a variety of plugins, but Vim is an editor, not an IDE, so you don’t need to install too many plugins, you only need to install the plugins you really need, remember, less is more.

Tip

When using synchronized to lock this in Java, the following two ways of writing are equivalent.

Share

I am using my vacation to think about me, and I think I am currently in a bottleneck. It seems that every day is very fulfilling, but the harvest is very limited. The reason for this should be the repetition of using the past ways, which leads to stagnation. To break through, I need to step out of your comfort zone and try new methods that I have not tried before, in order to break through.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
KeepNewbie_yan

KeepNewbie_yan

5 Followers

A programmer. Share knowledge of programming, operating system, Linux kernel, and reading, thinking etc. Let us maintain a beginner mend and grow together!