自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

源式羽语

有志于学,不赞美,不责难,只求了解认识。

  • 博客(93)
  • 资源 (9)
  • 收藏
  • 关注

原创 169. Majority Element

class Solution(object):    def majorityElement(self, nums):        """        :type nums: List[int]        :rtype: int        """        n=len(nums)        nums.sort()        l,r=0,n-1

2017-05-25 19:37:28 198

原创 162. Find Peak Element

class Solution(object):    def findPeakElement(self, nums):        """        :type nums: List[int]        :rtype: int        """        l=0        r=len(nums)-1        while l     

2017-05-25 19:29:26 219

原创 122. Best Time to Buy and Sell Stock II

class Solution(object):    def maxProfit(self, prices):        """        :type prices: List[int]        :rtype: int        """        res=0        for i in range(1,len(prices)):     

2017-05-25 11:52:01 297

原创 121Best Time to Buy and Sell Stock

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

2017-05-25 10:43:40 183

原创 120. Triangle

class Solution(object):    def minimumTotal(self, triangle):        """        :type triangle: List[List[int]]        :rtype: int        """        n=len(triangle)        dp=[0]*n     

2017-05-24 17:05:07 201

原创 119. Pascal's Triangle II

class Solution(object):    def getRow(self, rowIndex):        """        :type rowIndex: int        :rtype: List[int]        """        pre=[1,1]        if rowIndex==0:            retu

2017-05-24 15:22:41 171

原创 118. Pascal's Triangle

class Solution(object):    def generate(self, numRows):        """        :type numRows: int        :rtype: List[List[int]]        """        res=[]        if numRows==0:            re

2017-05-24 15:04:28 215

原创 106Construct Binary Tree from Inorder and Postorder Traversal

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

2017-05-24 12:30:57 192

原创 Construct Binary Tree from Preorder and Inorder Traversal

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

2017-05-24 11:13:25 215

原创 二叉树的遍历

1.二叉树遍历方式:先序遍历,后续遍历,中序遍历,层次遍历先 if(BT):getRootleftright中if (BT)leftget rootright后if(BT):leftrightgetroot每个节点遇到三次,先序是第一次取数字,中序点二次取,后续点三次取。路径一样,出口一样,入口一样

2017-05-24 10:14:12 207

原创 79. Word Search

class Solution(object): def exist(self, board, word): """ :type board: List[List[str]] :type word: str :rtype: bool """ for i in range(len(boar

2017-05-22 15:47:58 206

原创 566. Reshape the Matrix

class Solution(object):    def matrixReshape(self, nums, r, c):        """        :type nums: List[List[int]]        :type r: int        :type c: int        :rtype: List[List[int]]     

2017-05-22 14:32:32 259

转载 54. Spiral Matrix

class Solution(object):    def spiralOrder(self, matrix):        """        :type matrix: List[List[int]]        :rtype: List[int]        """        ret = []        while matrix:     

2017-05-19 17:08:40 244

原创 Combination Sum II

class Solution(object):    def combinationSum2(self, candidates, target):        """        :type candidates: List[int]        :type target: int        :rtype: List[List[int]]        """

2017-05-19 16:21:39 162

原创 39. Combination Sum

class Solution(object):    def combinationSum(self, candidates, target):        """        :type candidates: List[int]        :type target: int        :rtype: List[List[int]]        """ 

2017-05-19 16:01:03 169

原创 34. Search for a Range

class Solution(object):    def searchRange(self, nums, target):        """        :type nums: List[int]        :type target: int        :rtype: List[int]        """        l,r=0,len(nums

2017-05-19 11:34:23 222

原创 35. Search Insert Position

class Solution(object):    def searchInsert(self, nums, target):        """        :type nums: List[int]        :type target: int        :rtype: int        """        n=len(nums)     

2017-05-19 10:10:16 193

原创 [leetcode 561]Array Partition I

题目:求2n个数字的数组组成n对中的每个小数字之和最大nums.sort()        return sum(nums[::2])

2017-05-18 15:31:36 219

原创 [leetcode 560]Subarray Sum Equals K

题目:求连续子集和为k的个数代码出自:https://discuss.leetcode.com/topic/88041/super-simple-pythonclass Solution(object):    def subarraySum(self, nums, k):        """        :type nums: List[int]        :type k: int   ...

2017-05-18 15:13:18 516

原创 [leetcode525]Contiguous Array

class Solution(object):    def findMaxLength(self, nums):        """        :type nums: List[int]        :rtype: int        """        for i in range(len(nums)):            if nums[i]==0

2017-05-17 17:45:38 432

转载 [leetcode523]Continuous Subarray Sum

https://leetcode.com/problems/continuous-subarray-sum/#/solutionsclass Solution(object):    def checkSubarraySum(self, nums, k):        """        :type nums: List[int]        :type k:

2017-05-17 17:17:25 276

原创 [leetcode462] Minimum Moves to Equal Array Elements II

class Solution(object):    def minMoves2(self, nums):        """        :type nums: List[int]        :rtype: int        """        l,r ,count = 0,len(nums)-1,0        nums.sort()     

2017-05-17 16:40:01 282

原创 [return sum(nums)-min(nums)*len(nums)leetcode453】 Minimum Moves to Equal Array Elements

题意: 每次移动可以加1,移动的时候只能移动n-1个,需要移动多少次可以使得数组值都相等python :return sum(nums)-min(nums)*len(nums)class Solution(object):    def minMoves(self, nums):        """        :type nums: List[int]     

2017-05-17 16:10:38 320

原创 [leetcode 448]Find All Numbers Disappeared in an Array

同442一样,只是判断条件不一样class Solution(object):    def findDisappearedNumbers(self, nums):        """        :type nums: List[int]        :rtype: List[int]        """        f=[0]*(len(nums)

2017-05-17 15:16:26 294

原创 leetcode442 Find All Duplicates in an Array

解题思路:将值转化为下表,用值记录个数代码来自:https://leetcode.com/problems/find-all-duplicates-in-an-array/#/descriptionhttps://leetcode.com/problems/find-all-duplicates-in-an-array/#/solutionsclass Solution(objec

2017-05-17 15:05:34 213

原创 [leetcode 410]Split Array Largest Sum

题目理解:给一个非负数组,和划分数组的个数m问题:返回划分的m个子数组中和最大的哪个和,因为划分m个子数组的方法有很多种,假设有k种划分m个子数组的方法,所以就有k个子数组最大和的值,求出这k个值中最小的哪个值返回来。解决:二分查找(代码参考https://discuss.leetcode.com/topic/62139/python-solution-dp-and-binar

2017-05-17 11:23:26 430

原创 leetcode 384shuffle a array

class Solution(object):    def __init__(self, nums):        """        :type nums: List[int]        """        self.nums = nums    def reset(self):        """        Resets the

2017-05-17 09:40:29 199

原创 330. Patching Array

class Solution(object):    def minPatches(self, nums, n):        """        :type nums: List[int]        :type n: int        :rtype: int        """        size=len(nums)        i,add,

2017-05-15 11:55:02 229

原创 [leetcode238]Product of Array Except Self

class Solution(object):    def productExceptSelf(self, nums):        """        :type nums: List[int]        :rtype: List[int]        """        res=[0]*len(nums)        res[0]=1     

2017-05-15 10:40:33 185

原创 lettcode189Rotate Array

class Solution(object):    def rotate(self, nums, k):        """        :type nums: List[int]        :type k: int        :rtype: void Do not return anything, modify nums in-place instead. 

2017-05-11 15:45:40 195

原创 leetcode167Two Sum II - Input array is sorted

这个算法易于理解但是效果不是很好class Solution(object):    def twoSum(self, numbers, target):        """        :type numbers: List[int]        :type target: int        :rtype: List[int]        """

2017-05-11 14:23:35 204

原创 leetcode154Find Minimum in Rotated Sorted Array II

class Solution(object):    def findMin(self, nums):        """        :type nums: List[int]        :rtype: int        """        l,r=0,len(nums)-1        while l=nums[r]:            mi

2017-05-11 12:53:46 206

原创 letcode153Find Minimum in Rotated Sorted Array

class Solution(object):    def findMin(self, nums):        """        :type nums: List[int]        :rtype: int        """        l,r=0,len(nums)-1        while l            mid=l+(r-l)

2017-05-11 12:41:19 189

原创 python 报错集合

1.调用一个没有python中已命名过的变量时Line 33: Exception: Type : Not implementedException: Type : Not implemented原因:这是因为调用了python一个固有方法但同时没有实现它例如:print max,print help2.调用一个python中不存在的nin时报错: NameEr

2017-05-11 11:12:22 1253

原创 RNN的理解

场景:一个人x站在一个入口处,一个入口处有一道具w,还有一个来自上面的带着道具的朋友w'x'动作:这个人拿起了道具(此处变为wx)和站在门口的朋友进入了门,门里面有个试衣间,他们两个进入了试衣间合二为一个人(此处为y=wx+w'x'),这时给他们起名为yy出了试衣间,然后他又进入一个屋子,在屋子里他自己倒刺了一番,从屋子里出来后变成了b,最后b在下一个门前手里拿着上次出来时带的道具x等待着

2017-05-10 11:04:28 362

原创 [leetcode 53]Maximum Subarray

class Solution(object):    def maxSubArray(self, nums):        """        :type nums: List[int]        :rtype: int        """        if not nums:            return None        d=[0]*le

2017-05-09 21:46:32 182

原创 [leetcode108]Convert Sorted Array to Binary Search Tree

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

2017-05-09 21:14:45 186

原创 [leetcode 33]Search in Rotated Sorted Array

class Solution(object):    def search(self, nums, target):        """        :type nums: List[int]        :type target: int        :rtype: int        """        n=len(nums)        l,r=

2017-05-09 11:08:26 167

原创 leetcode31Next Permutation

class Solution(object):    def nextPermutation(self, nums):        """        :type nums: List[int]        :rtype: void Do not return anything, modify nums in-place instead.        """   

2017-05-09 10:38:16 156

原创 27. Remove Element

题目:数组中的重复元素都删掉,且返回长度要求:不可另外开空间解题思路:用两个指针,一个指开头,一个指结尾,当开头的与所给值相同时把结尾的值赋值过来,尾指针向前class Solution(object):    def removeElement(self, nums, val):        """        :type nums: List[int]

2017-05-08 21:34:17 206

绘制分子结构源码实例程序.rar

matlab 绘制分子结构源码,matlab 绘制分子结构源码,

2020-01-08

百度地图所有级别瓦片切割代码

该资源主要切割百度地图瓦片,可以切割19级以上。主要是用java切割完成。

2018-04-08

经纬度转摩卡坐标工具

本资源简单的将百度地图拾取的经纬度转换为百度地图使用的摩卡坐标,主要用于百度地图切瓦片时使用。

2018-04-02

xz-libs-5.1.2-12alpha.el7.x86_64.rpm

linux一个工具包,网上比较难找

2017-07-01

改编LSSVM回归预测matlab版code

改编lssvm。方便使用,guidence里有说明的demo。直接运行就可以,也可以根据自己的实际情况进行适当的修改。

2014-12-17

ELM回归预测matlab版code

使用emd进行回归预测的代码,使用方法结单,只需输入训练集和测试集就可以进行emd预测了,预测的结果会保存在相应的.mat文件里,详细操作请看代码里的操作说明。资源里有demo,guidence.m文件里有调用实例,直接复制到command windows里运行就可以了,简单易懂,汉语注释说明等。运行结果会直接输出测试集的MAE, RMSE, MAPE, DISTAT这几个统计量

2014-12-16

emd回归预测matlab版code

使用emd进行回归预测的代码,使用方法结单,只需输入训练集和测试集就可以进行emd预测了,预测的结果会保存在相应的.mat文件里,详细操作请看代码里的操作说明。资源里有demo,guidence.m文件里有调用实例,直接复制到command windows里运行就可以了,简单易懂,汉语注释说明等。

2014-12-16

安卓时间选择器

三级联动时间选择器,使用了wheelview 简单方便,可以直接加入项目中使用。

2014-10-27

web+struts

这是简单实在的一个web+struts2+hibernate项目,适合于初学者。

2013-05-24

空空如也

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

TA关注的人

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