自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(26)
  • 问答 (1)
  • 收藏
  • 关注

原创 numpy.split, array_split, hsplit, vsplit, dsplit大家庭参数含义与用法

见该说明文档:https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.split.html尤其值得记忆的是当indices_or_sections是1-D array(比如[2, 3])时代表的含义。另外,split默认是axis=0,代表沿行分离。...

2018-10-31 14:49:59 1240

原创 tensorflow.nn.conv2d中参数含义,尤其是strides

input=[number_of_pictures_each_batch, in_height, in_width, in_channels], 即[每个batch图片数目,每个图片高度,每个图片宽度,输入通道数目]。要求类型是float32和float64之一。filter=[filter_height, filter_width, in_channels, out_channels], 即...

2018-10-30 16:00:23 650

转载 utf-8无BOM编码格式什么意思?

UTF-8不需要BOM来表明字节顺序,但可以用BOM来表明编码方式。字符"ZERO WIDTH NO-BREAK SPACE"的UTF-8编码是EF BB BF。所以如果接收者收到以EF BB BF开头的字节流,就知道这是UTF-8编码了。 --------------------- 本文来自 浪漫鼠 的CSDN 博客 ,全文地址请点击。BOM: Byte Order MarkUTF-8 B...

2018-09-23 15:46:48 9149 1

原创 368. Largest Divisible Subset

class Solution: def largestDivisibleSubset(self, nums): """ :type nums: List[int] :rtype: List[int] """ if not nums: return [] if len(n...

2018-09-21 11:15:51 147

原创 357. Count Numbers with Unique Digits

class Solution: def countNumbersWithUniqueDigits(self, n): """ :type n: int :rtype: int """ # 解法来源https://leetcode.com/problems/count-numbers-with-unique-d...

2018-09-21 10:08:57 123

原创 343. Integer Break

class Solution: def integerBreak(self, n): """ :type n: int :rtype: int """ dp = [0 for i in range(n+1)] dp[1] = 1 for i in range(2, n+1):...

2018-09-06 18:05:20 98

原创 338. Counting Bits

class Solution: def countBits(self, num): """ :type num: int :rtype: List[int] """ # 右移一位(之前计算的记录下来)+ 末尾是否是1 num += 1 # 初始条件dp[0] = 0 ...

2018-09-06 13:57:28 105

原创 322. Coin Change

class Solution: def coinChange(self, coins, amount): """ :type coins: List[int] :type amount: int :rtype: int """ MAX = float('inf') # 初始条件...

2018-09-06 10:55:24 118

原创 309. Best Time to Buy and Sell Stock with Cooldown

class Solution: def maxProfit(self, prices): """ :type prices: List[int] :rtype: int """ if not prices or len(prices) == 1: return 0 ...

2018-09-02 14:51:13 96

原创 304. Range Sum Query 2D - Immutable

class NumMatrix: def __init__(self, matrix): """ :type matrix: List[List[int]] """ if not matrix: return None r = len(matrix) c = len(...

2018-09-02 13:50:58 278

原创 300. Longest Increasing Subsequence

class Solution: def lengthOfLIS(self, nums): """ :type nums: List[int] :rtype: int """ # dp[i] if not nums: return 0 n...

2018-09-02 13:09:02 112

原创 279. Perfect Squares

class Solution: def numSquares(self, n): """ :type n: int :rtype: int """# # BFS# # 每一层都减去所有可以减去的平方数,下一层判断所有(x-平方数)# if n < 2:# ...

2018-09-01 20:39:11 244

原创 264. Ugly Number II

class Solution: def nthUglyNumber(self, n): """ :type n: int :rtype: int """ ugly = [1] i2, i3, i5 = 0, 0, 0 for _ in range(2, n + 1): ...

2018-09-01 18:08:53 132

原创 221. Maximal Square

class Solution: def maximalSquare(self, A): """ :type A: List[List[str]] :rtype: int """ for i in range(len(A)): for j in range(len(A[i])): ...

2018-08-31 23:46:27 132

原创 python给多个数赋值,交换变量等

如果a = 1b = 2那么,交换a和b的值用python怎么做?如下:a, b = b, a原理是什么?是把 b, a当成了(b, a)元组。但之后本人在学习过程中经常遇到容易混淆的情形,比如:a, b = b, a + b结果是  还是 ? 记住一句话即可:先算右面! 正确。...

2018-08-29 21:28:49 1229

原创 213. House Robber II

class Solution: def rob(self, nums): """ :type nums: List[int] :rtype: int """ # 将第一家和最后一家分别去掉,用动态规划求出两个最大值,然后较大的那个就是 n = len(nums) if n ==...

2018-08-29 21:20:27 259

原创 152. Maximum Product Subarray

class Solution: def maxProduct(self, nums): """ :type nums: List[int] :rtype: int """ n = len(nums) maxi = nums[0] dp_min = [0] * n ...

2018-08-29 20:11:52 121

原创 139. Word Break

class Solution: def wordBreak(self, s, wordDict): """ :type s: str :type wordDict: List[str] :rtype: bool """ n = len(s) dp = [False] * (n ...

2018-08-29 14:35:45 115

原创 120. Triangle

class Solution: def minimumTotal(self, triangle): """ :type triangle: List[List[int]] :rtype: int """ # dp if not triangle: return 0 ...

2018-08-28 14:14:55 174

原创 91. Decode Ways

class Solution: def numDecodings(self, s): """ :type s: str :rtype: int """ # 动态规划dp[i]表示s第i个数时decode方式 if s == "": return 0 d...

2018-08-28 13:06:33 125

原创 64. Minimum Path Sum

class Solution: def minPathSum(self, grid): """ :type grid: List[List[int]] :rtype: int """ R = len(grid) C = len(grid[0]) dp = [[0] * C fo...

2018-08-28 11:58:23 121

原创 63. Unique Paths II

class Solution: def uniquePathsWithObstacles(self, obstacleGrid): """ :type obstacleGrid: List[List[int]] :rtype: int """ # base cases:第一行第一列为1,但遇到obstacl...

2018-08-27 17:06:33 108

原创 62. Unique Paths

class Solution: def uniquePaths(self, m, n): """ :type m: int :type n: int :rtype: int """ # 让初始第一行和第一列为1 dp = [[1] * n for _ in range(m)]...

2018-08-27 16:35:33 92

原创 5. Longest Palindromic Substring

class Solution: def longestPalindrome(self, s): """ :type s: str :rtype: str """ # dp ans = '' max_len = 0 n = len(s) DP = ...

2018-08-27 16:24:13 120

原创 python一行读取多个数字

最简单快捷的方式:l = list(map(int, input().split()))print(l) 

2018-08-21 12:44:34 9854

原创 python变量作用域:list直接就是全局变量

a = 1def fun(a): a += 1 print(a)fun(a)print(a)a = [1]def fun(): a.append(2) print(a)fun()print(a)输出21[1, 2][1, 2]list直接就是全局变量。

2018-08-08 22:34:47 5258

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除