自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(23)
  • 收藏
  • 关注

原创 【LeetCode】693. Binary Number with Alternating Bits

Python版本:python3.6.2693. Binary Number with Alternating BitsGiven a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have differentvalues.

2018-02-03 21:28:28 242

原创 【LeetCode】521. Longest Uncommon Subsequence I

Python版本:python3.6.2521. Longest Uncommon Subsequence IGiven a group of two strings, you need to find the longest uncommon subsequence of this group of two strings.The longest uncommon sub

2018-02-03 01:01:30 225

原创 【LeetCode】496. Next Greater Element I

Python版本:3.6.2496. Next Greater Element I自己的代码:class Solution: def nextGreaterElement(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int]

2018-02-02 20:47:13 172

原创 【学习笔记】Python的itertools模块

Python版本:python3.6.2参考:http://funhacks.net/2017/02/13/itertools/itertools模块包含的函数产生的是迭代器,而不是数组。1. countcount(start=0, step=1)创建一个从start(默认值为0)开始,以step(默认为1)为步长的无限迭代器。import itertoolsnums = itertools....

2018-02-02 19:55:23 618

原创 K-Means算法的Python实现和Matlab实现

参考:http://blog.topspeedsnail.com/archives/10349Python版本:python3.6.2Matlab版本:一、K-Means算法的Python实现这里以泰坦尼克号遇难者名单为例,通过除survived以外字段进行聚类(k=2,生/死),然后再和survived进行对比。数据集下载地址:http://blog.topspeedsnai

2018-02-01 16:43:13 1200 2

原创 【LeetCode】762. Prime Number of Set Bits in Binary Representation

Python版本:python3.6.2762. Prime Number of Set Bits in Binary RepresentationGiven two integers L and R, find the count of numbers in the range [L, R] (inclusive) having a prime number of set b

2018-02-01 16:42:02 275

原创 【LeetCode】566. Reshape the Matrix

Python版本:python3.6.2566. Reshape the MatrixIn MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with differentsize but keep its or

2018-01-28 16:42:02 150

原创 【LeetCode】412. Fizz Buzz

Python版本:python3.6.2412. Fizz BuzzWrite a program that outputs the string representation of numbers from 1 to n.But for multiples of three it should output “Fizz” instead of the number and f

2018-01-27 14:34:55 177

原创 【LeetCode】575. Distribute Candies

Python版本:python3.6.2575. Distribute CandiesGiven an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy

2018-01-26 16:31:14 123

原创 【LeetCode】682. Baseball Game

Python版本:python3.6.2682. Baseball GameYou're now a baseball game point recorder.Given a list of strings, each string can be one of the 4 following types:Integer (one round's scor

2018-01-23 19:20:37 206

原创 Python画K-means算法聚类后的日负荷曲线图

Python版本:Python3.6.2一、K-Means算法K-Means算法是聚类算法中最简单的,python中可以直接调用Kmeans()函数,其中参数n_clusters,指定要聚成几类。代码:# -*- coding: utf-8 -*-"""@Time : 2018/1/22 21:53@Author : Sunflower@

2018-01-23 11:25:07 9331 19

原创 【LeetCode】500. Keyboard Row

Python版本:Python3.6.2500. Keyboard Row先贴自己的代码:class Solution: def findWords(self, words): """ :type words: List[str] :rtype: List[str] """

2018-01-22 19:29:46 265

原创 【LeetCode】344. Reverse String

Python版本:Python3.6.2344. Reverse StringWrite a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh".这题应该昨天做的,昨天的是这题的进阶版

2018-01-21 10:29:36 112

原创 【LeetCode】557. Reverse Words in a String III

Python版本:Python3.6.2557. Reverse Words in a String IIIGiven a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial

2018-01-20 17:34:42 115

原创 【LeetCode】476. Number Complement

Python版本:Python3.6.2476. Number ComplementGiven a positive integer, output its complement number. The complement strategy is to flip the bits of its binaryrepresentation.Note:The given

2018-01-19 22:28:50 134

原创 Python画用电客户日负荷曲线图

Python版本:Python3.6.2一、日负荷曲线摘自百度百科,日负荷曲线是描述一日内负荷随时间变化的曲线。二、数据处理数据:申请的爱尔兰开源用户用电数据,txt格式,一个文件将近400M,用写字板打开,很卡。截取部分原始数据。数据附带的文档介绍,第一列是电表ID,第二列是时间,第三列是电量(kwh)。其中,时间5位数,前3位表示天,后2位取值:1-48,即每半小时记录一次电表。先导入Splu

2018-01-19 15:07:39 9240 30

原创 【LeetCode】561. Array Partition I

Python版本:Python3.6.2561. Array Partition IGiven an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai,

2018-01-18 21:39:23 165

原创 【LeetCode】728. Self Dividing Numbers

Python版本:Python3.6.2728. Self Dividing NumbersA 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 == 0, 128 % 2 =

2018-01-18 15:30:14 162

原创 【LeetCode】461. Hamming Distance

Python版本:Python3.6.2461. Hamming DistanceThe Hamming distance between two integers is the number of positions at which the corresponding bits are different.Given two integers x and y, calculate the Ha

2018-01-16 18:55:47 123

原创 【LeetCode】760. Find Anagram Mappings

Python版本:Python3.6.2760. Find Anagram MappingsGiven two lists Aand B, and B is an anagram of A. B is an anagram of A means B is made by randomizing the order of the elements in A.We want to find an in

2018-01-14 14:16:14 289

原创 【LeetCode】657. Judge Route Circle

Python版本:Python3.6.2657. Judge Route CircleInitially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle,which means it moves back to the original p

2018-01-14 12:48:55 132

原创 LeetCode刷题

以此博文纪念下我的LeetCode刷题阶段,目的就是未来半年多之后的找工作啦一共有700+题目,先从最简单的等级—Easy中Accepted率最高的题目开始,一步一步打怪升级!每日一刷,刷完来CSDN总结下!

2018-01-14 12:45:46 457

原创 PCA主成分分析法Matlab实现和Python实现

软件版本声明:Matlab版本:MATLAB R2016aPython版本:Python 3.6.2Matlab实现参考自博客:http://blog.csdn.net/guyuealian/article/details/68487833一、PCA的Matlab实现方法一:Matlab有关于主成分分析的函数——pca()函数,可以直接调用该函数完成数据集降维。

2018-01-04 15:27:15 1990

空空如也

空空如也

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

TA关注的人

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