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

本站现有博文333篇,共被浏览923518

本站已经建立2629天!

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