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

本站现有博文321篇,共被浏览768084

本站已经建立2452天!

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