DEnjoy

导航

2016年11月1日 #

leetcode日记 Combination sum IV

摘要: 题目: Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer tar 阅读全文

posted @ 2016-11-01 20:47 DEnjoy 阅读(139) 评论(0) 推荐(0) 编辑

2016年10月25日 #

二进制异或运算的应用

摘要: 异或运算又称XOR或EOR 二进制中为对应位进行运算,若相同则为0,不同则为1. 简单性质: 应用1:判断两个数是否相等 根据异或运算的定义,当两个数相同时,运算结果为0 应用2:通过异或运算将重复的两个数去除。 例:https://leetcode.com/problems/single-numb 阅读全文

posted @ 2016-10-25 17:34 DEnjoy 阅读(765) 评论(0) 推荐(0) 编辑

2016年9月18日 #

pytho简单爬虫_模拟登陆西电流量查询_实现一键查询自己的校园网流量

摘要: 闲来无事,由于校园内网络是限流量的,查询流量很是频繁,于是萌生了写一个本地脚本进行一键查询自己的剩余流量。 整个部分可以分为三个过程进行: 第一部分:对登陆时http协议进行分析 模拟浏览器进行登陆,那么就需要知道当浏览器进行登陆时发生了什么事情。对此可以参见下面这张自制的图,它展示了一次浏览器访问 阅读全文

posted @ 2016-09-18 16:23 DEnjoy 阅读(3023) 评论(3) 推荐(0) 编辑

2016年8月23日 #

leetcode 日记 162. Find Peak Element java python

摘要: 根据题目可知,输入为:一个相邻元素不相等的数列,输出为:其中一个(上)峰值的序号。并且要求时间复杂度为logn 分析:由于题目要求时间复杂度为logn,因此不能进行全部遍历。又因为只需要找到其中的一个峰值,那么,每次对半分,便可以达到logn的复杂度。 根据对半分的思路继续想,不难发现只要确定了中间 阅读全文

posted @ 2016-08-23 18:02 DEnjoy 阅读(572) 评论(0) 推荐(0) 编辑

2016年7月23日 #

leetcode 日记 4sum java

摘要: 整体思路同之前的一样,依然采取降低维度的方式进行 整体速度在leetcode上大概为50% 阅读全文

posted @ 2016-07-23 11:07 DEnjoy 阅读(162) 评论(0) 推荐(0) 编辑

2016年7月20日 #

leetcode 日记 3sumclosest java

摘要: 思路一为遍历: 整体思路二为将threeSum将为twoSum即可 本质上讲两种思路没有区别 阅读全文

posted @ 2016-07-20 17:42 DEnjoy 阅读(194) 评论(0) 推荐(0) 编辑

2016年5月10日 #

python leetcode 日记--Maximal Square--221

摘要: 题目: Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area. For example, given the following 阅读全文

posted @ 2016-05-10 23:08 DEnjoy 阅读(556) 评论(0) 推荐(0) 编辑

2016年5月7日 #

python leetcode 日记--231. Power of Two

摘要: 题目: Given an integer, write a function to determine if it is a power of two. 方法:分析2的幂次方的特点,发现2的任意次方的数,化成二进制时只有首位为1其余位为0,因此我的解决方法如下: bin函数能将一个给定的数化成二进制 阅读全文

posted @ 2016-05-07 18:55 DEnjoy 阅读(186) 评论(0) 推荐(0) 编辑

2016年3月28日 #

python leetcode 日记 --Contains Duplicate --217

摘要: 题目 Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the 阅读全文

posted @ 2016-03-28 21:17 DEnjoy 阅读(181) 评论(0) 推荐(0) 编辑

2016年3月14日 #

python leetcode 日记 --Contains Duplicate II --219

摘要: 题目: Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and 阅读全文

posted @ 2016-03-14 20:04 DEnjoy 阅读(307) 评论(0) 推荐(0) 编辑