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

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

本站已经建立2493天!

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