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

本站现有博文332篇,共被浏览875301

本站已经建立2583天!

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