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

本站现有博文336篇,共被浏览940183

本站已经建立2650天!

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