自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

vvickey11的博客

一直走

  • 博客(110)
  • 收藏
  • 关注

原创 anaconda py2 内暗安装anaconda py3 在anaconda py3内安装xgboost

1.下载好anaconda3可以选用官方的.sh文件或者清华镜像源的2.安装anaconda3位置: anaconda2/envs目录下创建py3文件夹将安装文件拷贝到此位置(按照这篇博客 https://www.cnblogs.com/mtcnn/p/9411739.html)$ bash Anaconda3-4.1.1-Linux-x86_64.sh -b -p $HOME...

2019-01-25 15:22:29 241

原创 anaconda2 安装xgboost

1.下载编译好的xgboost  https://blog.csdn.net/slibra_l/article/details/775007432.将解压后的文件夹拷贝到\anaconda2\Lib\site-packages3.进入文件夹…\site-packages\xgboost-master\python-package(要以管理员运行cmd),执行 python setup.py ...

2018-07-19 18:23:50 540

原创 ubuntu 硬盘挂载

首先查看分区硬盘情况sudo blkid然后修改开机自动挂载项sudo gedit /etc/fstab修改其中的UUID 记得有一个参数时defaults 不是default最后附一个参考连接:点击打开链接

2017-11-09 14:51:16 289

原创 520. Detect Capital

class Solution {public: bool detectCapitalUse(string word) { int len = word.size(); if(len<=0){ return false; } if(len == 1){ return true;

2017-07-10 16:49:29 295

原创 459. Repeated Substring Pattern

class Solution {public: bool repeatedSubstringPattern(string s) { int len = s.size(); //注意这里从1开始,因为最小包含子串的字符串是2 //必须是包含等于二分之一的原因是奇数个字符的字符串 for(int i = 1; i <= len/

2017-07-10 16:11:33 280

原创 434. Number of Segments in a String

class Solution {public: int countSegments(string s) { int count = 0 ; int len = s.size(); for(int i = 0 ; i < len ; i++ ){ if(s[i] == ' '){ co

2017-07-10 14:46:59 223

原创 523. Continuous Subarray Sum

参考链接:点击打开链接class Solution {public: bool checkSubarraySum(vector& nums, int k) { if(nums.empty()){ return false; } //注意map用法,还有就是这个题目用的是余数 //有相同余

2017-07-05 22:30:47 230

原创 303. Range Sum Query - Immutable

参考答案链接:点击打开链接class NumArray {public: //构造函数 NumArray(vector nums) { if(nums.empty()){ return; } else{ //求出从开始的0位置到当前i位置的累加和 /

2017-07-05 16:17:32 215

原创 629. K Inverse Pairs Array

参考答案:点击打开链接class Solution {public: int kInversePairs(int n, int k) { //if(n<=0) return; int dp[n+1][k+1]; int mod = 1000000007; memset(dp,0,sizeof(dp));

2017-07-04 14:27:38 264

原创 152. Maximum Product Subarray

分析法案:点击打开链接最小的负数乘以负数是可以变成最大的乘积,因为是可以当个值成为一个字串的所以有和单个值的比较。有两个乘积记录子序列的乘积,从最大的正值和最小的负值去记录更新。class Solution {public: int maxProduct(vector& nums) { int re; if(nums.empty()){

2017-06-14 15:59:19 205

原创 151. Reverse Words in a String

reverse讲解,size与capcity区别:点击打开链接参考代码解释:点击打开链接我的实现:class Solution {public: void reverseWords(string &s) { //利用reverse函数事半功倍 //string类型是可以用s[]这样来访问元素的 //storeIndex表示当前存

2017-06-14 10:41:16 252

原创 python分词脚本 注意python对于中文的编码方式

# -*- coding: UTF-8 -*-import os,sys import restr2 = 'C:/Users/Hit/Desktop/文本/199801.txt' path = unicode(str2,"utf8") fo = open(path) fw = open('new.txt','w')count = 0 done = 0while not done:

2017-05-25 16:35:28 436

原创 windows10 下jupyter路径

参考链接:点击打开链接点击打开链接import os,sysprint os.getcwd()# str1 = r"C:/Users/Hit/Desktop/文本/199801.txt"# f = open(str1.decode('utf8').encode('gbk'))str2 = 'C:/Users/Hit/Desktop/文本/199801.txt'path

2017-05-24 17:14:27 381

原创 111. Minimum Depth of Binary Tree

参考链接:点击打开链接/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL)

2017-05-24 10:41:45 196

原创 迭代思想要义

就是最近做的题我的迭代思想总是建立的残缺,恩可以用残缺来说。当迭代的时候,要记住下层的返回是上层,从上层迭代下层后一个位置开始运行上层。下层的结果只与上层有关,与其它层没有什么关系。所以最后的结果也只与次顶层有关。当条件不满足的情况下,下层是可以选择直接return的。同时基本的迭代的结构是:1.返回的条件2.迭代下层的条件一3.迭代下层的条件二

2017-05-23 22:37:21 362

原创 113. Path Sum II

参考链接:点击打开链接/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL)

2017-05-23 22:30:46 196

原创 112. Path Sum

/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */clas

2017-05-22 13:10:29 193

原创 119. Pascal's Triangle II

class Solution {public: vector getRow(int rowIndex) { vector res; if(rowIndex==0){ res.push_back(1); return res; } vector pre ; pre

2017-05-22 10:23:19 169

原创 118. Pascal's Triangle

class Solution {public: vector> generate(int numRows) { vector> res; if(numRows == 0) return res; if(numRows == 1) return {{1}}; for(int j = 0 ; j < numRows ; j+

2017-05-21 22:26:51 182

原创 309. Best Time to Buy and Sell Stock with Cooldown

参考:(1)点击打开链接class Solution {public: int maxProfit(vector& prices) { int len = prices.size(); //为了第一次买操作的不取prebuy,buy取系统最小值,这样就是之前卖的总值减去当前价格就是这次买的手里的价格 int prebuy = 0

2017-05-19 16:15:26 307

原创 188. Best Time to Buy and Sell Stock IV

参考链接:(1)点击打开链接(2)点击打开链接class Solution {public: int maxProfit(int k, vector& prices) { if(prices.size() == 0){ return 0; } if( k > prices.size()){

2017-05-19 10:56:40 188

原创 123. Best Time to Buy and Sell Stock III

参考了:(1)点击打开链接(2)点击打开链接class Solution {public: int maxProfit(vector& prices) { if(prices.size() == 0){ return 0; } int g[3] = {0} , l[3] = {0}; //

2017-05-19 10:07:37 159

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

class Solution {public: int maxProfit(vector& prices) { //这道题我想的太复杂了,其实就是从头开始,只要后项大于前项就把数据加入到结果中, //多次交易的累和,只能向后计算 //贪心算法 int len = prices.size(); int res

2017-05-18 15:02:41 159

原创 121. Best Time to Buy and Sell Stock

class Solution {public: int maxProfit(vector& prices) { int len = prices.size(); if (len == 0){ return 0; } int minpos = 0; int maxn = 0 ; int j = 0; for (int i = 0; i < len; i++){

2017-05-18 13:49:08 170

原创 Valid Palindrome

class Solution {public: bool isPalindrome(string s) { int len = s.size(); if(len <= 1){ //记住回文数长度为1,是回文数 return true; } bool ti = false ,tj

2017-05-17 20:04:28 156

原创 136. Single Number

class Solution {public: int singleNumber(vector& nums) { int temp = 0; //用异域的思想,出现两次的数就是最后异域为0,只有全部异域之后剩下的就是出现次数为1的元素 for(int i = 0 ; i < nums.size() ;i++){ te

2017-05-17 16:42:48 151

原创 141. Linked List Cycle

点击打开链接上面的参考的答案/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public

2017-05-17 16:03:42 154

原创 107. Binary Tree Level Order Traversal II

/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */clas

2017-05-17 15:07:07 147

原创 再次配置深度学习环境

1.制作U盘,安装ubuntu系统点击打开链接这篇文章写的很详尽了!

2017-05-13 11:31:31 197

原创 104. Maximum Depth of Binary Tree

递归解法:/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * };

2017-05-12 21:25:09 204

原创 101. Symmetric Tree

/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */clas

2017-05-12 15:24:35 178

原创 100. Same Tree

/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */clas

2017-05-12 13:59:05 144

原创 Merge Sorted Array

class Solution {public: void merge(vector& nums1, int m, vector& nums2, int n) { vector res; int i , j , k; if(nums2.size() == 0) return; for(i = 0 , j = 0 , k = 0

2017-05-12 10:41:49 140

原创 83. Remove Duplicates from Sorted List

/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode* de

2017-05-10 21:49:30 179

原创 LeetCode 69. Sqrt(x)

class Solution {public: int mySqrt(int x) { double cur = x,pre =0; while(abs(pre-cur)>0.000001){ pre = cur; cur = pre/2 + (x/(2*pre)); } r

2017-05-10 16:55:39 153

原创 66. Plus One

class Solution {public: vector plusOne(vector& digits) { int len = digits.size(); int plus = 0; for(int i = len - 1 ; i >=0 ;i--){ if(i == len - 1){

2017-05-10 10:47:47 149

原创 58. Length of Last Word

class Solution {public: int lengthOfLastWord(string s) { int len = s.size(); int res = 0; if(len == 0){ return 0; } for(int i = len -1 ; i>=0 ;

2017-05-09 20:15:50 137

原创 38. Count and Say

class Solution {public: string countAndSay(int n) { if( n <= 0){ return NULL; } string dp[n]; dp[0] = "1"; string now; string newstr;

2017-05-09 16:12:57 136

原创 35. Search Insert Position

class Solution {public: int searchInsert(vector& nums, int target) { int len = nums.size(); if(len == 0){ return 0; } if(target < nums[0] || target ==

2017-05-08 21:29:56 158

原创 28. Implement strStr()

class Solution {public: int strStr(string haystack, string needle) { int len1 = haystack.size(); int len2 = needle.size(); int i = 0 ; int index; //当两个序列的

2017-05-08 21:00:41 152

空空如也

空空如也

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

TA关注的人

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