• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • YouClaw
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
村雨sup
自己选的路,跪着也要走完 XD
博客园    首页    新随笔    联系   管理    订阅  订阅
09 2018 档案
LeetCode 48

摘要:这种方法首先对原数组取其转置矩阵,然后把每行的数字翻转可得到结果,如下所示(其中蓝色数字表示翻转轴): 1 2 3 1 4 7 7 4 1 4 5 6 --> 2 5 8 --> 8 5 2 7 8 9 3 6 9 9 6 3 _很好的数学思想,不是单纯的蛮力旋转 阅读全文
posted @ 2018-09-24 14:56 村雨sup 阅读(101) 评论(0) 推荐(0)
LeetCode 47

摘要:class Solution { public: vector> permuteUnique(vector& nums) { set> res; vector add; vector vis(nums.size(),0); BFS(nums,res,add,vis,0); return vector>(res... 阅读全文
posted @ 2018-09-24 14:38 村雨sup 阅读(121) 评论(0) 推荐(0)
LeetCode 46

摘要:// 又是可以用回溯法做的一道题。class Solution { public: vector> permute(vector& nums) { vector vis(nums.size(),0); vector> res; vector add; DFS(nums,0,res,add,vis); retu... 阅读全文
posted @ 2018-09-24 11:46 村雨sup 阅读(95) 评论(0) 推荐(0)
LeetCode 40

摘要:// 既然不能重复利用,就在递归中选择下一个数,不能重复的话,就用setclass Solution { public: vector> combinationSum2(vector& candidates, int target) { set> res; sort(candidates.begin(),candidates.end()); ... 阅读全文
posted @ 2018-09-24 10:40 村雨sup 阅读(134) 评论(0) 推荐(0)
Leetcode 39

摘要://经典回溯法class Solution { public: vector> combinationSum(vector& candidates, int target) { vector> res; sort(candidates.begin(),candidates.end()); vector add; DFS(ca... 阅读全文
posted @ 2018-09-24 10:30 村雨sup 阅读(130) 评论(0) 推荐(0)
手写DCGAN

摘要://加上了注释,对pytorch又加深了理解import torch as t from torch import nn from torch.autograd import Variable from torch.optim import Adam from torchvision import transforms from torchvision.utils import make_gri... 阅读全文
posted @ 2018-09-23 16:42 村雨sup 阅读(273) 评论(0) 推荐(0)
Leetcode 33

摘要://这题真的很有思维难度啊,前前后后弄了2个小时才写完。//一定要首先将连续的一段找出来,如果target在里面就在里面找,如果不在连续段里就在另一部分找。//如果后面二分到都是连续段也是没事了,我们找的另一段也是连续的没有问题的。//最后面de的两个bug是判断nums[left] & nums, int target) { int left = 0; int ... 阅读全文
posted @ 2018-09-18 17:02 村雨sup 阅读(153) 评论(0) 推荐(0)
Leetcode 34

摘要://二分查找后,向两边扩展,二分错了两次,现在是对的。//还有就是vector可以用{}直接赋值很棒class Solution { public: vector searchRange(vector& nums, int target) { int left = 0; int right = nums.size()-1; int mid ... 阅读全文
posted @ 2018-09-18 14:52 村雨sup 阅读(325) 评论(0) 推荐(0)
Leetcode 35

摘要://在数组最后插入INT_MAX是个好方法class Solution { public: int searchInsert(vector& nums, int target) { nums.push_back(INT_MAX); for(int i=0;i < nums.size();i++){ if(target <= nums... 阅读全文
posted @ 2018-09-18 14:10 村雨sup 阅读(105) 评论(0) 推荐(0)
Leetcode 28

摘要://有个神奇的东西class Solution { public: int strStr(string haystack, string needle) { if(needle == "")return 0; int lenn = haystack.size()-needle.size(); //如果不用这个直接把haystack.size()-needl... 阅读全文
posted @ 2018-09-18 09:56 村雨sup 阅读(115) 评论(0) 推荐(0)
Leetcode 27

摘要:easy 阅读全文
posted @ 2018-09-18 09:05 村雨sup 阅读(82) 评论(0) 推荐(0)
Leetcode 26

摘要:class Solution { public: int removeDuplicates(vector& nums) { int res = 0; nums.push_back(INT_MAX); //注意末尾的补位 for(int i=0;i < nums.size()-1;i++){ if(nums[i] !... 阅读全文
posted @ 2018-09-18 08:47 村雨sup 阅读(70) 评论(0) 推荐(0)
Leetcode 24

摘要://需要注意的就是只用一个pre就能完成交换,一次AC,happy,已经忘记了第一次写链表时候的痛苦,所以说算法没难的,只不过练的欠火候。/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val... 阅读全文
posted @ 2018-09-17 17:02 村雨sup 阅读(134) 评论(0) 推荐(0)
记录:每日工作 监督自我

摘要:2018.9.16 上午看了白书的GAN部分和了解到BUCT的github,下午看了李宏毅GAN课程2讲,对GAN的运作方式有了初步认识,晚上打游戏。 2018.9.17 上午看了李宏毅的第3,4讲,做了笔记,感觉后面都在讲各种不同的GAN,还处理了一些杂事,下午恰巧看到风格迁移的GAN代码,试了试 阅读全文
posted @ 2018-09-16 17:05 村雨sup 阅读(225) 评论(0) 推荐(0)
Leetcode 21

摘要:/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; *///还可以简单的一遍AC class Solution { public: ... 阅读全文
posted @ 2018-09-12 11:39 村雨sup 阅读(108) 评论(0) 推荐(0)
Leetcode 20

摘要:别人写的:差距啊! 阅读全文
posted @ 2018-09-11 17:25 村雨sup 阅读(119) 评论(0) 推荐(0)
Leetcode 19

摘要:/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; *///一开始发现头结点不好删啊,然后加了一个前置节点就ok了 class Solut... 阅读全文
posted @ 2018-09-10 17:00 村雨sup 阅读(105) 评论(0) 推荐(0)
Leetcode 18

摘要:class Solution { public: vector> fourSum(vector& nums, int target) { if(nums.size() > res; sort(nums.begin(),nums.end()); for(int i=0;i cnt){n--;} els... 阅读全文
posted @ 2018-09-10 15:52 村雨sup 阅读(133) 评论(0) 推荐(0)
Leetcode 16

摘要://一次AC 有点爽的class Solution { public: int threeSumClosest(vector& nums, int target) { int res = 0; int minal = INT_MAX; sort(nums.begin(),nums.end()); for(int i=0;i ... 阅读全文
posted @ 2018-09-10 15:23 村雨sup 阅读(109) 评论(0) 推荐(0)
Leetcode 15

摘要://用类似双指针的方法,确定第一个i的位置后,j和k向左向右移动使nums[j]+nums[k] = -nums[i];注意特判class Solution { public: vector> threeSum(vector& nums) { if (nums.empty()||nums.size() > res; sort(nums.begin(),nu... 阅读全文
posted @ 2018-09-10 11:38 村雨sup 阅读(115) 评论(0) 推荐(0)
Leetcode 12

摘要:_ 阅读全文
posted @ 2018-09-09 17:31 村雨sup 阅读(110) 评论(0) 推荐(0)
Leetcode 9

摘要://反转之后判断就行了class Solution { public: bool isPalindrome(int x) { int t = x; if(x 0){ sum = sum*10 + x%10; x = x/10; } if(sum == t) ... 阅读全文
posted @ 2018-09-09 12:10 村雨sup 阅读(81) 评论(0) 推荐(0)
Leetcode 5

摘要:_ 阅读全文
posted @ 2018-09-08 22:30 村雨sup 阅读(133) 评论(0) 推荐(0)
Leetcode 7

摘要:_ 阅读全文
posted @ 2018-09-08 11:12 村雨sup 阅读(82) 评论(0) 推荐(0)
Leetcode 3

摘要:O(N^3)的复杂度竟然过了(╯‵□′)╯︵┻━┻ _ 复杂度O(N)解法 这里我们可以建立一个256位大小的整型数组来代替HashMap,这样做的原因是ASCII表共能表示256个字符,所以可以记录所有字符,然后我们需要定义两个变量res和left,其中res用来记录最长无重复子串的长度,left 阅读全文
posted @ 2018-09-07 11:09 村雨sup 阅读(139) 评论(0) 推荐(0)
Leetcode 2

摘要:我可能是个傻子,本来都给我逆序写好了,我偏要列表反转一下,mdzz 既然写了也要贴出来 —— 阅读全文
posted @ 2018-09-06 14:57 村雨sup 阅读(98) 评论(0) 推荐(0)
Leetcode 1

摘要:hash map 构建查找表,用target减去第一个找第二个,要注意如果target是自己的两倍也是要排除的,即: if(m.count(t) !=0 && m[t] != i) 阅读全文
posted @ 2018-09-06 12:02 村雨sup 阅读(101) 评论(0) 推荐(0)
Pytorch CNN的各种参数

摘要:conv :卷积层(2d就是二维平面的) kernel_size 卷积核大小 stride 每次移动的步长 padding 四周填充的大小,注意是四周所以在算下一层的向量维度时要将padding 乘以 2 maxpool2d 二维平面的池化层 dense:全链接层 Linear 一层神经元 输入维数 阅读全文
posted @ 2018-09-02 14:04 村雨sup 阅读(646) 评论(0) 推荐(0)

博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3