EADST

LeetCode: Quickly setup the Python List

Recently, I have done lots of LeetCode problems. Here are some quick shortcuts to change the list.

# initial one-dimensional array with length N
Array = [0] * N

# initial two-dimensional array with M*N
Matrix = [[0] * N for _ in range(M)]

# reverse the list [0, 1, 2]->[2, 1, 0]
new_list = old_list[::-1]
new_list = old_list.reverse()

# pop out the element in the list [0, 1, 2]->[0, 2]
new_list = old_list.pop(1)

# insert the element in the list [0, 1, 2]->[0, "s", 1, 2]
new_list = old_list.insert(1, "s")

# For a four-direction traversal, create an array [-1, 0, 1, 0, -1], each of which is one of the four directions.

相关标签
About Me
XD
Goals determine what you are going to be.
Category
标签云
音频 Tiktoken Llama ONNX Random Jetson Pandas MD5 PDF FP64 QWEN WebCrawler Bipartite Review Math TSV CTC Ubuntu 关于博主 Pytorch Transformers Algorithm IndexTTS2 Ptyhon Freesound printf CEIR Video Django 飞书 腾讯云 Michelin 继承 Safetensors Password Domain 云服务器 JSON git-lfs Excel CSV 搞笑 Translation XML Git ResNet-50 强化学习 Streamlit GGML Qwen2.5 Anaconda Input ChatGPT RGB Quantize Mixtral GoogLeNet diffusers DeepStream LoRA Hotel Nginx 公式 CC Plotly Hilton Python hf 阿里云 Sklearn PyCharm 版权 UI Github uWSGI Dataset 净利润 Search 多线程 v2ray llama.cpp GPT4 torchinfo Gemma Magnet Breakpoint mmap Qwen Zip 多进程 Cloudreve Knowledge Google 论文速读 Image2Text Permission Bin Paper 图形思考法 LeetCode 算法题 FP32 AI C++ v0.dev 证件照 BF16 logger API网关 签证 顶会 Bitcoin Pillow icon PyTorch transformers 域名 YOLO Claude PDB uwsgi SQL scipy UNIX Conda ModelScope LLM Pickle Land OpenCV NLP Linux Vmess Windows Tracking HaggingFace Miniforge NameSilo 财报 VSCode WAN Disk CAM 论文 Quantization COCO SVR Use RL News Docker RAR SPIE Augmentation Markdown Color FastAPI Attention Interview Firewall TensorRT DeepSeek BeautifulSoup Heatmap 报税 tar CUDA FP8 Paddle Tensor GPTQ CLAP Animate Bert Harness 图标 Statistics Diagram Card BTC Baidu API InvalidArgumentError XGBoost TensorFlow ms-swift CV Distillation Web VPN Shortcut Vim SAM Hungarian PIP Jev Rebuttal SQLite Plate GIT Base64 OpenAI Agent Data Food TTS Logo EXCEL Website LaTeX 第一性原理 tqdm OCR Qwen2 Clash HuggingFace 递归学习法 Numpy FP16 Template Jupyter VGG-16 NLTK Crawler git Proxy FlashAttention Datetime LLAMA
站点统计

本站现有博文337篇,共被浏览961502次

本站已经建立2673天!

热门文章
文章归档
回到顶部