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

本站现有博文324篇,共被浏览817258

本站已经建立2522天!

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