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

本站现有博文332篇,共被浏览895434

本站已经建立2597天!

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