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

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

本站已经建立2718天!

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