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

本站现有博文323篇,共被浏览800383

本站已经建立2499天!

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