Skip to content

Instantly share code, notes, and snippets.

class Solution {
// 头插法
public ListNode reverseList(ListNode head) {
ListNode dummy = new ListNode(-1);
dummy.next = head;
ListNode pre = dummy;
ListNode cur = head;
while (cur!=null && cur.next!=null) {
// Leetcode 92 反转链表II
class Solution {
public ListNode reverseBetween(ListNode head, int left, int right) {
ListNode dummy = new ListNode(-1);
dummy.next = head;
ListNode pre = dummy;
ListNode cur = dummy.next;
for (int i = 0; i < left-1; i++) {
pre = pre.next;
@xuzheng465
xuzheng465 / .vimrc
Created January 26, 2022 08:28 — forked from rocarvaj/.vimrc
Minimal .vimrc for C/C++ developers
" VIM Configuration File
" Description: Optimized for C/C++ development, but useful also for other things.
" Author: Gerhard Gappmeier
"
" set UTF-8 encoding
set enc=utf-8
set fenc=utf-8
set termencoding=utf-8
" disable vi compatibility (emulation of old bugs)
@xuzheng465
xuzheng465 / createidrs.c
Created June 24, 2021 06:05
create directories for book chapters in the current path
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <string.h>
#include <errno.h>
int main(int argc, char *argv[])
{
char *name = "Ch";
int num;
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/xuzheng/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
@xuzheng465
xuzheng465 / download_pdf.py
Created March 7, 2020 03:54
仓鼠症爆发
import requests
from bs4 import BeautifulSoup
from pathlib import Path
url = "https://cs186berkeley.net/"
folder = Path("/Users/xuzheng/Desktop/self/cs186-database/test/")
pdfs = []
r = requests.get(url)
html = r.text
bs = BeautifulSoup(html, 'html.parser')
@xuzheng465
xuzheng465 / useHexo.md
Created December 22, 2017 06:44 — forked from btfak/useHexo.md
How to use Hexo and deploy to GitHub Pages