自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(89)
  • 资源 (1)
  • 收藏
  • 关注

转载 Xgboost和lightgbm的区别

https://www.cnblogs.com/mata123/p/7440774.htmlhttps://www.cnblogs.com/infaraway/p/7890558.htmlXgboost缺点:1、        在每次迭代的时候都要遍历整个训练数据多次,如果把整个训练数据装进内存则会限制训练数据的大小;如果不装进内存,反复地读写训练数据又会消耗非常大的时间2、        预排序...

2018-04-12 09:34:02 1407

转载 CART算法处理连续特征

https://blog.csdn.net/shenxiaoming77/article/details/51603504CART算法的重要基础包含以下三个方面:(1)二分(Binary Split):在每次判断过程中,都是对观察变量进行二分。CART算法采用一种二分递归分割的技术,算法总是将当前样本集分割为两个子样本集,使得生成的决策树的每个非叶结点都只有两个分枝。因此CART算法生成的决策树是...

2018-04-11 22:17:00 5508

转载 推荐系统的排序指标

1.Mean Average Precision (MAP)AP=∑nij=1P(j).yi,j∑nij=1yi,jAP=∑j=1niP(j).yi,j∑j=1niyi,j 其中, yi,jyi,j:排序中第j个元素对于查询i是否是相关的;相关为1,不相关为0。 P(j)=∑k:πi(k)≤πi(j)y(i,k)πi(j)P(j)=∑k:πi(k)≤πi(j)y(i,k)πi(j) 其中, πi(...

2018-04-11 21:42:26 1933

转载 爱奇艺个性化推荐排序实践

爱奇艺个性化推荐排序实践2017-11-14 14:58爱奇艺/视频/测评在海量的内容在满足了我们需求的同时,也使我们寻找所需内容更加困难,在这种情况下个性化推荐应运而生。在当前这个移动互联网时代,除了专业内容的丰富,UGC内容更是爆发式发展,每个用户既是内容的消费者,也成为了内容的创造者。这些海量的内容在满足了我们需求的同时,也使我们寻找所需内容更加困难,在这种情况下个性化推荐应运而生。个性化推...

2018-04-11 21:39:02 452

转载 Find Peak Element(二分查找)

原题链接:162. Find Peak Element【思路-Java、Python】 二分查找题目中已经说明,最左端和最右端元素均无限小,中间元素比两侧都要大,那么本题中一定存在一个峰元素。所以不管中间有多少波峰,只要找到峰元素,我们只需找到刚刚开始下降而未下降的位置。采用二分查找,查出这样一个位置即可,我们知道二分查找要比较的是 target 元素,本题的 target 元素是 mid 的后一...

2018-04-26 12:49:37 241

原创 Missing number

Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.For example,Given nums = [0, 1, 3] return 2.Note:Your algorithm should run in linea...

2018-04-26 12:49:31 184

转载 Find the Duplicate Number

[Leetcode]287. Find the Duplicate Number简单解法及解释 双指针复杂度O(n)原创 2016年01月01日 11:34:20标签:leetcode /指针 /时间复杂度 /空间复杂度4871题目链接:Find the Duplicate NumberGiven an array nums containing n + 1 integers where each...

2018-04-26 12:49:28 197

原创 Rotate Array

【问题描述】Rotate an array of n elements to the right by k steps.For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].Note:Try to come up as many solutions as you can,...

2018-04-26 12:49:23 131

原创 Largest Rectangle in Histogram

Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.Above is a histogram where width of each bar...

2018-04-26 12:49:19 127

原创 Search in Rotated Sorted Array

public static int search(int []nums, int target){ int left = 0; int right = nums.length - 1; while(left <= right){ int mid = left + (right - left)/2; // 2 ...

2018-04-26 12:49:14 126

原创 Convert Integer A to Integer B

1. A代表的二进制数转为B代表的二进制数,编辑距离是多少, public static int bitSwapRequired(int a, int b) { int count = 0; int a_xor_b = a ^ b; while (a_xor_b != 0) { ++count; a_xor_b &= (a_xor_b - 1); ...

2018-04-26 12:49:10 541

原创 Longest Increasing Continuous subsequence1,2(数组和矩阵)

1. 在数组中查找dppublic int findLengthOfLCIS(int[] nums) { if (nums.length == 0) return 0;         int[] dp = new int[nums.length];         Arrays.fill(dp, 1);         int max = 1;         for (int i =...

2018-04-26 12:49:06 143

原创 多线程下载图片

"""import os, multiprocessingimport urllib3, certifiimport pandas as pdimport numpy as npdef DownloadImage(key_url): try: (key, url, out_dir) = key_url.values[0] filename = os...

2018-04-25 07:43:48 325

原创 Summary Ranges(两个指针)

Summary Ranges Total Accepted: 511 Total Submissions: 2271Given a sorted integer array without duplicates, return the summary of its ranges.For example, given [0,1,2,4,5,7], return ["0->2","4->5...

2018-04-25 07:43:43 267

原创 Combination sum||| & 1v(动态规划)

 立即登录[LeetCode] Combination Sum III | Combination Sum IV数组  java backtracking linspiration 2016年06月03日发布赞  |   0收藏  |  11.4k 次浏览Combination Sum IIIProblemFind all possible combinations of k numbers th...

2018-04-25 07:43:39 213

原创 Minimum Size Subarray Sum(滑动窗口和两个指针)

一、问题描述Description:Description:Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn’t one, return 0 instead.For examp...

2018-04-25 07:43:34 392

原创 First Missing Positive 类似计数排序

 First Missing Positive 类似计数排序[java] view plain copypublic int firstMissingPositive(int[] A) {        if(A==null || A.length==0)        {            return 1;        }        for(int i=0;i<A.length...

2018-04-25 07:43:27 112

原创 3Sum Closest

3Sum Closest:Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would...

2018-04-25 07:43:22 107

原创 Container with water

public class Solution { public int maxArea(int[] height) { int left = 0, right = height.length - 1, maxArea = 0; while(left < right){ // 每次更新最大面积(盛水量) ma...

2018-04-25 07:43:09 121

原创 Subsets,permutations ,combinations

1. Subsets子集:递归图2. 上一个排列(从后向前找后边大于前面的数,前面记为K,后面记为k+1,交换【k+1,n-1]中的比k稍微大元素,逆序[k+1,n-1])3. 排列

2018-04-25 07:43:04 152

转载 LeetCode中与Permutations相关的共有四题:详解

  LeetCode中与Permutations相关的共有四题:   31. Next Permutation   46. Permutations   47. Permutations II   60. Permutation Sequence   大致包括了所有全排列问题可能考到的题型。   本文按序列出了解这四道题的详细思路和AC代码。在各题之间,尽可能地使用了不同的解法,使大家对各种方法能...

2018-04-25 07:42:52 159

原创 最大子数组和1,2

1.  最大子数组和,返回最大和public int maxSubArray(ArrayList<Integer> nums) {    // -1 is not proper for illegal input    if (nums == null || nums.isEmpty()) return -1;    int sum = 0, minSum = 0, maxSub...

2018-04-25 07:42:46 130

原创 Best Time to Buy and Sell Stock

1. 只允许一次交易,找差值最大的波峰和波谷。public int maxProfit(int[] prices) { if (prices == null || prices.length <= 1) return 0; int profit = 0; int curPriceMin = Integer.MAX_VALUE; for (int price : ...

2018-04-24 13:54:00 88

原创 Partition List

public ListNode partition(ListNode head, int x) { if (head == null) return null; ListNode leftDummy = new ListNode(0); ListNode left = leftDummy; ListNode rightDummy = new ListNode(0); ListN...

2018-04-24 13:53:48 87

原创 Remove Dumplicates from unsorted array

public static ListNode deleteDuplicates(ListNode head) { if (head == null) return null; ListNode curr = head; while (curr != null) { ListNode inner = curr;    while (inner.next ...

2018-04-24 13:53:41 207

原创 O(1)check of power 2

class Solution {/** @param n: An integer* @return: True or false*/public boolean checkPowerOf2(int n) {    if (n < 1) { return false; } else { return (n & (n - 1)) == 0; ...

2018-04-24 13:53:34 157

原创 digitCounts 统计0-n之间k字符出现的个数

public int digitCounts(int k, int n) { int count = 0; char kChar = (char)(k + '0'); for (int i = k; i <= n; i++) { char[] iChars = Integer.toString(i).toCharArray(); for (char iChar : i...

2018-04-24 13:52:41 235

原创 Factorial Trailing Zeroes

1. 一个数末尾0的个数public int trailingZeroes(int n) { if (n == 0) { return 0; } else if (n < 0) { return -1; } else { return n / 5 + trailingZeroes(n / 5); } }

2018-04-24 13:52:32 109

原创 Majority 主元素1,2,3

1. 1/2public int majorityNumber(ArrayList<Integer> nums) { if (nums == null || nums.isEmpty()) return -1; // pair<key, count> int key = -1, count = 0; for (int num : nums) { // ...

2018-04-24 13:52:21 141

原创 Exhaustive Search - 穷竭搜索

方法:1. 递归函数2. 栈3. 队列4. 深度优先搜索(DFS, Depth-First Search),又常称为回溯法5. 广度优先搜索(BFS, Breadth-First Search) 1. Subsets:DFSpublic List<List<Integer>> subsets(int[] nums) { List<List<Integer&...

2018-04-24 13:52:11 2677

转载 寻找数组中最小的k个数(快排和堆排)

题目描述输入n个整数,找出其中最小的K个数。例如输入4,5,1,6,2,7,3,8这8个数字,则最小的4个数字是1,2,3,4,。思路1:利用快排的思想,寻找第k个位置上正确的数,k位置前面的数即是比k位置小的数组,k后面的数即是比k位置元素大的数组。 public ArrayList<Integer> GetLeastNumbers_Solution(int [] input, in...

2018-04-24 13:52:03 886

原创 prepare for google & ms

1. 最短路径2. 拓扑排序3. 关键路径4. 最小二叉树5. 通过交换 a,b 中的元素,使[序列 a 元素的和]与[序列 b 元素的和]之间的差最小。 算出两者和之差,然后使用二分查找方法,交换元素,计算和之差和当前和之差进行对比,如果小于则重新复制,否则继续交换。6. 单例设计模式7. 对称字符串的最大长度:从两边向中间找,如果相等,计数器加一,不等则计数器置为08. ...

2018-04-24 13:51:49 118

转载 Single Number||

Single Number II  Total Accepted: 12144 Total Submissions: 37399My SubmissionsGiven an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm sho...

2018-04-22 14:10:22 106

原创 Wood Cut(二分查找)

public int woodCut(int[] L, int k) { if (L == null || L.length == 0) return 0; int lb = 0, ub = Integer.MAX_VALUE; while (lb + 1 < ub) { int mid = lb + (ub - lb) / 2; if (C(L, k, mid)) ...

2018-04-22 12:45:42 207

转载 sqrt(二分查找)

http://oj.leetcode.com/problems/sqrtx/求一个整数的平方根,如果该整数的平方根不是整数的话,返回平方根取整。最简单办法,暴力搜索从1到N/2搜索但会TLE。二分搜索,开始区间是1,终止区间是x。AC代码:[java] view plain copypublic class Solution {      public int sqrt(int x) {     ...

2018-04-22 12:39:34 485

原创 旋转数组求最小值和找指定位置的数

旋转数组的概念就是对有序数组循环向右移动K位得到的数组。 例如[1,2,3,4,5]经过右移2位后旋转后得到:[4,5,1,2,3]一、如何得到旋转数组比如说现在要求旋转右移K位,求移动后的结果。第一步要对K进行处理,因为假设原数组是[1,2,3]: 当K=1,旋转数组为[3,1,2] 当K=2,旋转数组为[2,3,1] 当K=3,旋转数组为[1,2,3] 当K=4,旋转数组为[3,1,2] … ...

2018-04-22 11:10:32 504

原创 First Bad Versioin

public int findFirstBadVersion(int n) { int lb = 0, ub = n + 1; while (lb + 1 < ub) { int mid = lb + (ub - lb) / 2; if (VersionControl.isBadVersion(mid)) { ub = mid; } else { ...

2018-04-22 10:43:50 115

原创 Search Insert position( 二分查找)

public int searchInsert(int[] A, int target) { if (A == null || A.length == 0) { return -1; } int start = -1, end = A.length; while (start + 1 < end) { int mid = start + (end - s...

2018-04-22 10:41:40 210

原创 Find the kth largest element(快排)

Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example,Given [3,2,1,5,6,4] and k = 2, return 5.Note: Y...

2018-04-22 10:36:03 820

转载 Partition Array by Odd and Even

[LintCode]Partition Array by Odd and Even[java] view plain copypublic class Solution {      /**      * @param nums: an array of integers      * @return: nothing      */      public void partitionArray...

2018-04-22 10:33:31 118

自编码网络系列详解

学习自编码非常全的资料,资料包括了AE,CAE,DAE,SDAE,SAE等常见的网络,推导详细,原理讲解很详细。。。。。

2017-09-12

空空如也

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

TA关注的人

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