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

本站现有博文339篇,共被浏览998501次

本站已经建立2709天!

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