- 博客(61)
- 资源 (1)
- 收藏
- 关注
原创 Leetcode:206. Reverse Linked List
Leetcode:206. Reverse Linked List 这题直接ac掉class Solution { public ListNode reverseList(ListNode head) { ListNode prev = null; while(head!=null) { ...
2017-12-30 17:04:00 85
原创 leetcode:234. Palindrome Linked List
leetcode:234. Palindrome Linked List 这个题目非常好。http://blog.csdn.net/u012249528/article/details/47124771给出了三种解法,其中前两个是不满足条件的,不过具有参考价值:第一种办法:用数组倒着存前半段的链表的值,然后和后半段链表的值进行比较。这种解法运行的时间...
2017-12-23 11:33:00 73
原创 java单链表反转
java单链表反转 今天做leetcode,遇到了单链表反转。研究了半天还搞的不是太懂,先做个笔记吧参考:http://blog.csdn.net/guyuealian/article/details/51119499 https://www.cnblogs.com/hiver/p/7008112.htmlclass Node { p...
2017-12-21 12:37:00 101
原创 Leetcode:9. Palindrome Number
Leetcode:9. Palindrome Number 这题要求不能使用额外的空间,我也就没做,看了下别人的代码,挺有意义的一道题目,出坏了。解题思路:从右往左颠倒过来,看看这个值和原来的x值是不是一样,最后还要注意像20这种情况,也是的public boolean isPalindrome(int x) { if (x<...
2017-12-21 10:00:00 74
原创 《精通Spring4.X企业应用开发实战》读后感第七章(创建增强类)
《精通Spring4.X企业应用开发实战》读后感第七章(创建增强类) posted on 2017-12-20 12:34 Michael23...
2017-12-20 12:34:00 71
原创 leetcode:8. String to Integer (atoi)
leetcode:8. String to Integer (atoi) 这题难就难在不知道要考虑那些情况,也没个实例参考:https://www.cnblogs.com/springfor/p/3896499.html有四个条件需要考虑:自己参考上面四个条件写出了自己的代码,结果老是错。例如:“+-2”,结果应该是0参考实现https:...
2017-12-20 10:45:00 55
原创 leetcode:7. Reverse Integer
leetcode:7. Reverse Integer 这题简单,也花了我好长时间,我自己写的code比较麻烦,也没啥技巧:按正负性分类执行,先转化成字符串,用stringbuilder进行旋转,如果超出范围了就用try catchpublic int reverse(int x) { try { in...
2017-12-20 09:51:00 114
原创 《精通Spring4.X企业应用开发实战》读后感第七章(AOP基础知识、jdk动态代理,CGLib动态代理)...
《精通Spring4.X企业应用开发实战》读后感第七章(AOP基础知识、jdk动态代理,CGLib动态代理) posted on 2017-12-20 00:34 Michael2397 阅读(......
2017-12-20 00:34:00 58
原创 《精通Spring4.X企业应用开发实战》读后感第七章(AOP概念)
《精通Spring4.X企业应用开发实战》读后感第七章(AOP概念) posted on 2017-12-20 00:09 Michael2397 阅读(...) 评论(...) 编辑 收藏 ...
2017-12-20 00:09:00 73
原创 Leetcode:6. ZigZag Conversion
Leetcode:6. ZigZag Conversion 参考:http://blog.csdn.net/linhuanmars/article/details/21145039#reply,找规律public String convert(String s, int nRows) { if(s == null || s.length...
2017-12-19 10:13:00 79
原创 Leetcode:647. Palindromic Substrings
Leetcode:647. Palindromic Substrings 参考第5题http://www.cnblogs.com/Michael2397/p/8036163.html,一下子就ac掉了,这里有个解释https://discuss.leetcode.com/topic/96884/very-simple-java-solution-with...
2017-12-19 09:24:00 88
原创 Leetcode:516. Longest Palindromic Subsequence
Leetcode:516. Longest Palindromic Subsequence 参考:http://algorithms.tutorialhorizon.com/longest-palindromic-subsequence/ (老外写的博文,有图有字很形象)http://blog.csdn.net/thesnowboy_2/article/...
2017-12-18 12:37:00 79
原创 Leetcode:336. Palindrome Pairs
Leetcode:336. Palindrome Pairs 这题一上来就会想到暴力破解,破解代码见http://blog.csdn.net/u012848330/article/details/51660542,超时public class Solution { public List<List<Integer>&g...
2017-12-18 10:41:00 85
原创 Leetcode:214. Shortest Palindrome
Leetcode:214. Shortest Palindrome 解法一:很奇妙的解法:https://www.programcreek.com/2014/06/leetcode-shortest-palindrome-java/public String shortestPalindrome(String s) { i...
2017-12-15 10:23:00 66
原创 《精通Spring4.X企业应用开发实战》读后感第六章(容器事件)
《精通Spring4.X企业应用开发实战》读后感第六章(容器事件) posted on 2017-12-14 17:54 Michael2397 阅读(...) 评论(...) 编辑 收藏 ...
2017-12-14 17:54:00 88
原创 《精通Spring4.X企业应用开发实战》读后感第六章(国际化)
《精通Spring4.X企业应用开发实战》读后感第六章(国际化) posted on 2017-12-14 17:24 Michael2397 阅读(...) 评论(...) 编...
2017-12-14 17:24:00 81
原创 《精通Spring4.X企业应用开发实战》读后感第六章(引用Bean的属性值)
《精通Spring4.X企业应用开发实战》读后感第六章(引用Bean的属性值) posted on 2017-12-14 16:56 Michael2397 阅读(...) 评论(...) 编辑 收藏 ...
2017-12-14 16:56:00 77
原创 《精通Spring4.X企业应用开发实战》读后感第六章(使用外部属性文件)
《精通Spring4.X企业应用开发实战》读后感第六章(使用外部属性文件) posted on 2017-12-14 16:33 Michael2397 阅读(...) 评论(...) 编辑...
2017-12-14 16:33:00 65
原创 《精通Spring4.X企业应用开发实战》读后感第六章(属性编辑器)
《精通Spring4.X企业应用开发实战》读后感第六章(属性编辑器) posted on 2017-12-14 15:57 Michael2397 阅读(...) 评论(......
2017-12-14 15:57:00 75
原创 Leetcode:5. Longest Palindromic Substring
Leetcode:5. Longest Palindromic Substring 一开始题目没读懂,下面是求首末是同一个字符的最长子字符串:import java.util.HashMap;import java.util.HashSet;import java.util.Map;import java.util.Set;/...
2017-12-14 09:53:00 94
原创 《精通Spring4.X企业应用开发实战》读后感第六章(内部工作机制、BeanDefinition、InstantiationStrategy、BeanWrapper)...
《精通Spring4.X企业应用开发实战》读后感第六章(内部工作机制、BeanDefinition、InstantiationStrategy、BeanWrapper) posted on 2...
2017-12-14 00:38:00 109
原创 Leetcode: 3. Longest Substring Without Repeating Characters
Leetcode: 3. Longest Substring Without Repeating Characters 这题一开始我理解错了。后来自己去解也没完成,看了参考,看了半天没懂为什么,虽然代码短,但是逻辑性很高~解题思想:设置滑动窗口import java.util.HashMap;import java.util.Hash...
2017-12-13 20:20:00 53
原创 4. Median of Two Sorted Arrays
4. Median of Two Sorted Arrays 一看题目难度是“难”,吓到我了,上午想了一会就看讨论组的解法了,解法都很发杂呀!!!下午来到实验室看了一篇中文博客,说有两种解决方案,第一种就是将两个数组合并成一个数组,我的解法就是这样子的,竟然ac掉了!!import java.util.ArrayList;import j...
2017-12-13 15:40:00 64
原创 Leetcode:445. Add Two Numbers II
Leetcode:445. Add Two Numbers II 这题可以结合着前面几个博客的思想来解决,当然网上给出了更好的解决方案值得学习我自己实现的代码,因为对java指针的使用不太熟悉,调试了一个小时。思路:先将l1,l2存放到字符串中(因为字符串的长度不受限制,而数组的长度会受到限制),然后从数组的最后一位开始计算public Li...
2017-12-12 21:24:00 67
原创 Leetcode: 43. Multiply Strings
Leetcode: 43. Multiply Strings 题目难度中等,想到分别遍历num1、num2中的数值,但是具体细节没有理清。参考:https://discuss.leetcode.com/topic/30508/easiest-java-solution-with-graph-explanation?page=1public...
2017-12-12 19:34:00 86
原创 Leetcode:415. Add Strings
Leetcode:415. Add Strings 结合着这篇http://www.cnblogs.com/Michael2397/p/8027782.html自己完全实现了,顿时感觉到刷题有套路啊public class TwoSumbin { public String addStrings(String num1, String ...
2017-12-12 15:34:00 75
原创 Leetcode: 371. Sum of Two Integers
Leetcode: 371. Sum of Two Integers 这一题要用到|,&,<<等运算,完全参考https://discuss.leetcode.com/topic/49764/0ms-ac-java-solution/2算是当作学习了public class TwoSumbin { publ...
2017-12-12 15:32:00 67
原创 Leetcode: 67. Add Binary
Leetcode: 67. Add Binary 二进制加法 https://discuss.leetcode.com/topic/33693/another-simple-java public String addBinary(String a, String b) { if(a==null||b==null){...
2017-12-12 14:53:00 82
原创 Leetcode: 2. Add Two Numbers
Leetcode: 2. Add Two Numbers 一直想用一个进位变量来存贮进位值,但老是考虑不周全,下面是我自己写的bug代码,考虑不周,因为l1或者l2都有可能为nullclass Solution { public ListNode addTwoNumbers(ListNode l1, ListNode l2) { ...
2017-12-11 21:15:00 87
原创 Leetcode:560. Subarray Sum Equals K
Leetcode:560. Subarray Sum Equals K 最简单的方式,虽然oj没有说超时,但是时间还是挺多的public class SubArraySum { public int subarraySum(int[] nums, int k) { int count=0; for (in...
2017-12-11 20:13:00 90
原创 Leetcode: 653. Two Sum IV - Input is a BST
Leetcode: 653. Two Sum IV - Input is a BST 超时代码:只多了一个bool变量就超时了import java.util.ArrayList;import java.util.List;public class SumBSt { public boolean findTa...
2017-12-11 09:48:00 117
原创 Leetcode: 167. Two Sum II - Input array is sorted
Leetcode: 167. Two Sum II - Input array is sorted 超时的代码:public class Sum22 { public int[] twoSum(int[] numbers, int target) { int result[] = new int[2]; ...
2017-12-11 09:14:00 52
原创 Leetcode:454. 4Sum II
Leetcode:454. 4Sum II 参考:https://discuss.leetcode.com/topic/67658/simple-java-solution-with-explanationimport java.util.Arrays;import java.util.HashMap;import java.util.Map...
2017-12-11 08:59:00 66
原创 LeetCode: 18. 4Sum
LeetCode: 18. 4Sum 递归调用的例子,参考网上的实现https://discuss.leetcode.com/topic/46339/my-solution-generalized-for-ksums-in-java/5class Solution { int len =0; public List<...
2017-12-11 00:46:00 67
原创 LeetCode:15. 3Sum
LeetCode:15. 3Sum 自己的解法,有问题,花费我三个小时import java.util.ArrayList;import java.util.Arrays;import java.util.List;public class Sum3 { public static void main(Strin...
2017-12-10 20:32:00 61
原创 Leetcode:1. Two Sum
Leetcode:1. Two Sum public class TwoSum1 { public static void main(String[] args) { int[] nums = new int[]{2, 7, 11, 15}; int target = 9; int a[...
2017-12-10 17:00:00 123
原创 tensorflow placeholder
tensorflow placeholder placeholder 是 Tensorflow 中的占位符,暂时储存变量.Tensorflow 如果想要从外部传入data, 那就需要用到 tf.placeholder(), 然后以这种形式传输数据 sess.run(***, feed_dict={input: **}). 需要传入的值放在了feed_...
2017-12-07 10:53:00 106
原创 Tensorflow变量
Tensorflow变量 import tensorflow as tfstate = tf.Variable(0, name='counter')# 定义常量 oneone = tf.constant(1)# 定义加法步骤 (注: 此步并没有直接计算)new_value = tf.add(state, one)# 将...
2017-12-07 10:48:00 68
原创 tensorflow session会话控制
tensorflow session会话控制 import tensorflow as tf# create two matrixesmatrix1 = tf.constant([[3,3]])matrix2 = tf.constant([[2], [2]])product = ...
2017-12-07 10:36:00 84
原创 tensorflow第一个例子
tensorflow第一个例子 import tensorflow as tfimport numpy as np# create datax_data = np.random.rand(100).astype(np.float32)y_data = x_data*0.1 + 0.3Weights = tf.Variable(tf...
2017-12-07 01:56:00 200
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人