首页
AI Coding
NEW
沸点
课程
直播
活动
AI刷题
APP
插件
搜索历史
清空
创作者中心
写文章
发沸点
写笔记
写代码
草稿箱
创作灵感
查看更多
会员
登录
注册
leetcode
我是王大你是谁
创建于2021-05-12
订阅专栏
python 解答 leetcode
等 30 人订阅
共750篇文章
创建于2021-05-12
订阅专栏
默认顺序
默认顺序
最早发布
最新发布
leetcode 598. Range Addition II ( Python )
Given an m * n matrix M initialized with all 0's and several update operations. Operations are represented by a 2D array, and each operatio…
leetcode 892. Surface Area of 3D Shapes ( Python )
On a N * N grid, we place some 1 * 1 * 1 cubes. Each value v = grid[i][j] represents a tower of v cubes placed on top of grid cell (i, j). …
leetcode 812. Largest Triangle Area ( Python )
You have a list of points in the plane. Return the area of the largest triangle that can be formed by any 3 of the points. 根据题意,暴力破解,遍历各个点的…
leetcode 258. Add Digits ( Python )
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. 根据题意,把每位数字进行相加,最后一直加到得到一个十以内的数字即可,时间复杂…
leetcode 1009. Complement of Base 10 Integer ( Python )
leetcode 1009. Complement of Base 10 Integer ( Python ) 使用位运算解题
leetcode 1103. Distribute Candies to People ( Python )
We then give 1 candy to the first person, 2 candies to the second person, and so on until we give n candies to the last person. Then, we go…
leetcode 908. Smallest Range I ( Python )
Given an array A of integers, for each integer A[i] we may choose any x with -K <= x <= K, and add x to A[i]. After this process, we have s…
leetcode 942. DI String Match ( Python )
Given a string S that only contains "I" (increase) or "D" (decrease), let N = S.length. 根据题意,找出规律,如果是 "I" 那就是找一个可选值的最小值,如果是 "D" 那就是找一个可选值的最…
leetcode 883. Projection Area of 3D Shapes ( Python )
On a N * N grid, we place some 1 * 1 * 1 cubes that are axis-aligned with the x, y, and z axes. Each value v = grid[i][j] represents a towe…
leetcode 728. Self Dividing Numbers ( Python )
A self-dividing number is a number that is divisible by every digit it contains. For example, 128 is a self-dividing number because 128 % 1…
leetcode 712. Minimum ASCII Delete Sum for Two Strings ( Python )
Given two strings s1, s2, find the lowest ASCII sum of deleted characters to make two strings equal. 根据题意,可以看出这种求最优的问题可以用 DP 算法来解决,其实直接使用 L…
leetcode 413. Arithmetic Slices ( Python )
A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive eleme…
leetcode 983. Minimum Cost For Tickets ( Python )
In a country popular for train travel, you have planned some train travelling one year in advance. The days of the year that you will trave…
leetcode 647. Palindromic Substrings ( Python )
Given a string, your task is to count how many palindromic substrings in this string. The substrings with different start indexes or end in…
leetcode 830. Positions of Large Groups ( Python )
In a string S of lowercase letters, these letters form consecutive groups of the same character. For example, a string like S = "abbxxxxzyy…
leetcode 931. Minimum Falling Path Sum ( Python )
Given a square array of integers A, we want the minimum sum of a falling path through A. A falling path starts at any element in the first …
leetcode 303. Range Sum Query - Immutable ( Python )
Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. 根据题意,设置一个 sums 数组,长度为 len(nums)+1 ,索引…
leetcode 338. Counting Bits ( Python )
Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary represent…
leetcode 1030. Matrix Cells in Distance Order ( Python )
We are given a matrix with R rows and C columns has cells with integer coordinates (r, c), where 0 <= r < R and 0 <= c < C. Additionally, w…
leetcode 350. Intersection of Two Arrays II ( Python )
Given two arrays, write a function to compute their intersection. 根据题意,先把两个列表排序,然后设置两个指针 i 和 j 遍历两个数组,判断是否有相同的元素,最后把结果都放入列表返回即可。时间复杂度为 O(Nl…
下一页