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

本站现有博文340篇,共被浏览1018349次

本站已经建立2718天!

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