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

本站现有博文338篇,共被浏览972263次

本站已经建立2685天!

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