码农张学友

好菜啊,菜的睡不着

【Leetcode】377. Combination Sum IV

class Solution1(object): def combinationSum4(self, nums, target): """ 直接递归,会超时 因为这里面有大量的重复计算,并且题目的意思是相同的值的...

2019-05-21 09:27:41

阅读数 3

评论数 0

【Leetcode】376. Wiggle Subsequence

class Solution1(object): def wiggleMaxLength(self, nums): """ use up[i] and down[i] to denote the wiggleMaxLength ...

2019-05-21 09:01:01

阅读数 3

评论数 0

【Leetcode】76. Minimum Window Substring

class Solution1(object): def minWindow(self, s, t): """ use a dict to store the count of d each character of t, we...

2019-05-20 20:36:57

阅读数 5

评论数 0

【Leetcode】44. Wildcard Matching

class Solution(object): def isMatch(self, s, p): """ '?' Matches any single character. '*' Matches any seque...

2019-05-20 19:28:34

阅读数 5

评论数 0

【Leetcode】1047. Remove All Adjacent Duplicates In String

class Solution(object): def removeDuplicates(self, S): """ use stack """ stack = []...

2019-05-20 00:55:13

阅读数 7

评论数 0

【Leetcode】1048. Longest String Chainpde

class Solution(object): def longestStrChain(self, words): """ use dp and Counter """ ...

2019-05-20 00:53:19

阅读数 8

评论数 0

【Leetcode】375. Guess Number Higher or Lower II

class Solution(object): def getMoneyAmount(self, n): """ use dp[i][j] represent money amount if we guess a number ...

2019-05-18 09:41:21

阅读数 8

评论数 0

Jupyter 下 ModuleNotFoundError: No module named 'mxnet'

mxnet 安装在了conda的虚拟环境下,但是jupyter 起的kernel 是原生的python的环境导致的. 这时需要在conda virtual environment 中创建kernel ,然后使用该kernel即可正常使用mxnet 可参考: jupyter中添加conda虚拟环境 ...

2019-05-17 19:50:36

阅读数 10

评论数 0

【Leetcode】368. Largest Divisible Subset

class Solution(object): def largestDivisibleSubset(self, nums): """ Dp solution , we use dp[i] to denote the large...

2019-05-17 09:14:59

阅读数 10

评论数 0

【Leetcode】357. Count Numbers with Unique Digits

class Solution(object): def countNumbersWithUniqueDigits(self, n): """ we can take x apart , for example if n = 2,...

2019-05-17 08:19:04

阅读数 11

评论数 0

【Leetcode】35. Search Insert Position

class Solution(object): def searchInsert(self, nums, target): """ duplicates condition should be take care of ...

2019-05-16 08:38:08

阅读数 9

评论数 0

【Leetcode】303. Range Sum Query - Immutable

class NumArray1(object): """ store num from start to current position use minus operation to get result ""&q...

2019-05-15 20:25:03

阅读数 16

评论数 0

【Leetcode】343. Integer Break

class Solution1(object): def integerBreak(self, n): """ for each number , we check all pair which sum is number an...

2019-05-15 16:41:55

阅读数 12

评论数 0

【Leetcode】338. Counting Bits

class Solution1(object): """ traditional ways , in each step, we count 1 of number use bit operation """ ...

2019-05-15 15:36:12

阅读数 11

评论数 0

【Leetcode】322. Coin Change

class Solution1(object): def coinChange(self, coins, amount): """ :type coins: List[int] :type amount: int...

2019-05-15 14:34:38

阅读数 10

评论数 0

【Leetcode】309. Best Time to Buy and Sell Stock with Cooldown

class Solution1(object): """ use yes[i] to denote the people is in the condition of holding prices at i-th day, they can buy p...

2019-05-15 12:53:57

阅读数 10

评论数 0

【Leeetcode】304. Range Sum Query 2D - Immutable

class NumMatrix(object): """ we need two steps to solve this question step: calc out the acreage of rectangle whose to...

2019-05-15 00:26:29

阅读数 13

评论数 0

【Leetcode】300. Longest Increasing Subsequence

class Solution1(object): def lengthOfLIS(self, nums): """ use dp[i] to represent the longest of increasing sequenc...

2019-05-14 22:27:29

阅读数 10

评论数 0

【Leetcode】279. Perfect Squares

class Solution1(object): def numSquares(self, n): """ we use dp[i] to present number i's result if i is a ...

2019-05-13 23:02:36

阅读数 15

评论数 0

【Leetcode】95. Unique Binary Search Trees II

# Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.ri...

2019-05-13 22:05:39

阅读数 12

评论数 0

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