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

本站现有博文320篇,共被浏览760690

本站已经建立2432天!

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