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

本站现有博文328篇,共被浏览852890

本站已经建立2560天!

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