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

本站现有博文327篇,共被浏览833726

本站已经建立2538天!

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