山椒鱼666
码龄7年
求更新 关注
提问 私信
  • 博客:12,451
    12,451
    总访问量
  • 75
    原创
  • 3
    粉丝
  • 1
    关注
IP属地以运营商信息为准,境内显示到省(区、市),境外显示到国家(地区)
IP 属地:上海市
加入CSDN时间: 2018-11-29
博客简介:

微博@山椒鱼只想坐在地上生根发芽

查看详细资料
个人成就
  • 获得4次点赞
  • 内容获得2次评论
  • 获得2次收藏
  • 博客总排名767,009名
创作历程
  • 76篇
    2019年
成就勋章
TA的专栏
  • 推荐系统
  • leetcode
    73篇
  • 面经
  • tensorflow
    1篇
  • 数据库
    1篇

TA关注的专栏 0

TA关注的收藏夹 0

TA关注的社区 0

TA参与的活动 0

创作活动更多

新星杯·14天创作挑战营·第13期

这是一个以写作博客为目的的创作活动,旨在鼓励大学生博主们挖掘自己的创作潜能,展现自己的写作才华。如果你是一位热爱写作的、想要展现自己创作才华的小伙伴,那么,快来参加吧!我们一起发掘写作的魅力,书写出属于我们的故事。我们诚挚邀请你们参加为期14天的创作挑战赛!注: 1、参赛者可以进入活动群进行交流、互相鼓励与支持(开卷),虚竹哥会分享创作心得和涨粉心得,答疑及活动群请见:https://bbs.csdn.net/topics/619781944 【进活动群,得奖概率会更大,因为有辅导】 2、文章质量分查询:https://www.csdn.net/qc

75人参与 去参加
  • 最近
  • 文章
  • 专栏
  • 代码仓
  • 资源
  • 收藏
  • 关注/订阅/互动
更多
  • 最近

  • 文章

  • 专栏

  • 代码仓

  • 资源

  • 收藏

  • 关注/订阅/互动

  • 社区

  • 帖子

  • 问答

  • 课程

  • 视频

搜索 取消

leetcode题解(六): Regular Expression Matching

题目描述:正则表达式匹配难度:hard例子:Example 1:Input:s = “aa”p = “a”Output: falseExplanation: “a” does not match the entire string “aa”.Example 2:Input:s = “aa”p = “a*”Output: trueExplanation: ‘*’ mean...
原创
博文更新于 2019.01.28 ·
134 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

leetcode题解(七十三):309. Best Time to Buy and Sell Stock with Cooldown

问买卖股票最多能收益多少,这道题和之前的不同是买卖一次之后需要经历一个冷却期public int maxProfit(int[] prices) { int sell = 0, prev_sell = 0, buy = Integer.MIN_VALUE, prev_buy; for (int price : prices) { prev_buy = buy;...
原创
博文更新于 2019.06.03 ·
151 阅读 ·
1 点赞 ·
0 评论 ·
0 收藏

leetcode题解(七十二):300. Longest Increasing Subsequence

題意:給出一個數組,求最長遞增子序列的長度Example:Input: [10,9,2,5,3,7,101,18]Output: 4Explanation: The longest increasing subsequence is [2,3,7,101], therefore the length is 4.public int lengthOfLIS(int[] nums) { /...
原创
博文更新于 2019.06.02 ·
156 阅读 ·
1 点赞 ·
0 评论 ·
0 收藏

leetcode题解(七十一):287. Find the Duplicate Number

题意:找出一个数组中唯一的重复元素Example 1:Input: [1,3,4,2,2]Output: 2Example 2:Input: [3,1,3,4,2]Output: 3比较巧妙的思路:把数组想象成链表来做,跟链表是否有环的一题解题思路很像int findDuplicate3(vector<int>& nums){ if (nums.size()...
原创
博文更新于 2019.05.17 ·
137 阅读 ·
1 点赞 ·
0 评论 ·
0 收藏

在google Colaboratory中使用tensorboard

一个简单的例子:运行结束之后,点击刷新,在左侧的文件栏下会出现:打开logs文件,里面就是我们需要展示的tensor文件,点击下载后面就是tensorboard --logDIR = logs(文件夹名)如果打不开网址,tensorboard生成的网址(localhost或者127.0.0.1)打不开的解决方法:在最后加上 --host=127.0.0.1成功~enjoy~...
原创
博文更新于 2019.05.14 ·
1503 阅读 ·
1 点赞 ·
0 评论 ·
1 收藏

leetcode题解(七十):283. Move Zeroes

public void moveZeroes(int[] nums) { if (nums == null || nums.length == 0) return; int insertPos = 0; for (int num: nums) { if (num != 0) nums[insertPos++] = num; } ...
原创
博文更新于 2019.05.06 ·
119 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

leetcode题解(六十九):279. Perfect Squares

输入一个数,输出是他是几个数的平方和用动态规划来做public int numSquares(int n) { int[] dp = new int[n + 1]; Arrays.fill(dp, Integer.MAX_VALUE); dp[0] = 0; for(int i = 1; i <= n; ++i) { int min = Integer.MAX_VALUE;...
原创
博文更新于 2019.05.06 ·
134 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

leetcode题解(六十八):240. Search a 2D Matrix II

这道题public class Solution { public boolean searchMatrix(int[][] matrix, int target) { if(matrix == null || matrix.length < 1 || matrix[0].length <1) { return false; ...
原创
博文更新于 2019.05.06 ·
182 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

leetcode题解(六十七):239. Sliding Window Maximum

public int[] maxSlidingWindow(int[] a, int k) { if (a == null || k <= 0) { return new int[0]; } int n = a.length; int[] r = new int[n-k+1]; int ri = 0; // store index Deque<I...
原创
博文更新于 2019.05.06 ·
145 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

leetcode题解(六十六):238. Product of Array Except Self

求一个数组中每一个元素除了它本身的积Example:Input: [1,2,3,4]Output: [24,12,8,6]思路:左右两边同时遍历就可以节省时间public class Solution {public int[] productExceptSelf(int[] nums) { int n = nums.length; int[] res = new i...
原创
博文更新于 2019.05.05 ·
112 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

leetcode题解(六十五):236. Lowest Common Ancestor of a Binary Tree

二叉树两个节点的最低公共祖先public class Solution { public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) { if(root == null || root == p || root == q) return root; TreeNo...
原创
博文更新于 2019.05.05 ·
127 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

leetcode题解(六十四):234. Palindrome Linked List

判断是不是回文序列,中心对称Example 1:Input: 1->2Output: falseExample 2:Input: 1->2->2->1Output: true用快慢指针,链表反转来做public boolean isPalindrome(ListNode head) { ListNode fast = head, slow = hea...
原创
博文更新于 2019.05.05 ·
109 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

leetcode题解(六十三):226. Invert Binary Tree

转换左右子树,还是树的递归public TreeNode invertTree(TreeNode root) { if (root == null) { return null; } //递归下去 TreeNode right = invertTree(root.right); TreeNode left = invertTree(roo...
原创
博文更新于 2019.05.05 ·
130 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

leetcode题解(六十二):221. Maximal Square

二维数组中找1构成的面积最大的矩形Example:Input:1 0 1 0 01 0 1 1 11 1 1 1 11 0 0 1 0Output: 4public int maximalSquare(char[][] a) { if(a.length == 0) return 0; int m = a.length, n = a[0].length, result...
转载
博文更新于 2019.05.05 ·
117 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

leetcode题解(六十一):215. Kth Largest Element in an Array

找数组中第k大的元素可以用快排的partition函数来做public int findKthLargest(int[] nums, int k) { //打乱初始顺序是关键 shuffle(nums); k = nums.length - k; int lo = 0; int hi = nums.length - 1; ...
原创
博文更新于 2019.05.05 ·
136 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

leetcode题解(六十):208. Implement Trie (Prefix Tree)

例子:Example:Trie trie = new Trie();trie.insert(“apple”);trie.search(“apple”); // returns truetrie.search(“app”); // returns falsetrie.startsWith(“app”); // returns truetrie.insert(“app”);...
原创
博文更新于 2019.05.05 ·
111 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

leetcode题解(五十九):207. Course Schedule

课程安排,输入是课程总数,上课的方式,输出是否可行Example 1:Input: 2, [[1,0]]Output: trueExplanation: There are a total of 2 courses to take.To take course 1 you should have finished course 0. So it is possible.Example ...
原创
博文更新于 2019.05.04 ·
113 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

leetcode题解(五十八):206. Reverse Linked List

反转链表,基本操作Example:Input: 1->2->3->4->5->NULLOutput: 5->4->3->2->1->NULLpublic ListNode reverseList(ListNode head) { /* iterative solution */ ListNode newHead =...
原创
博文更新于 2019.05.03 ·
129 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

leetcode题解(五十七):200. Number of Islands

二维数组中数数岛的个数岛指由1构成的四周都是0(上下左右)的地方Example 1:Input:11110110101100000000Output: 1Example 2:Input:11000110000010000011Output: 3public class Solution {private int n;private int m;public...
原创
博文更新于 2019.05.03 ·
124 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

leetcode题解(五十六):198. House Robber

抢劫,不能抢相邻两家店铺问最多能抢多少典型的动态规划问题Example 1:Input: [1,2,3,1]Output: 4Explanation: Rob house 1 (money = 1) and then rob house 3 (money = 3).Total amount you can rob = 1 + 3 = 4.Example 2:Input: [2,7...
原创
博文更新于 2019.05.03 ·
105 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏
加载更多