- 博客(24)
- 问答 (1)
- 收藏
- 关注
原创 mysql时间存储用什么类型
关于夏令时,UTC,GMT这几个概念建议先简单了解下,下面不做解释先丢结论以表诚意:如果程序不需要考虑时区,夏令时或者将来数据库的机子迁移到别的地方时区变化,用datetime类型比较方便;用timestamp可以避免上述的问题(mysql官方文档的简单解释是数据存入timestamp时会根据时区转换为UTC时间,取出的时候做个反转换),但众所周知timestamp的存储位数只有4
2016-10-25 22:26:42 8965
原创 volley硬盘缓存取不到值可能是因为cachekey问题
volley取不到硬盘缓存,可能是因为volley版本太新,Request类的变动导致的。
2016-04-06 19:13:35 850 3
原创 理解LinkedHashMap实现LRU缓存
工作里项目的代码有看到用hashmap做简单缓存的,一直没去细看,最近研究了一下,发现好像这题还是面试的比较多的题,自己在这里做下总结。自己用google搜中文结果,博客园里这篇博客是排第一的http://www.cnblogs.com/lzrabbit/p/3734850.html,算比较详实,但像文章里3楼评论说的那样,实现Map接口并不能保证获得线程安全,然后文章的另一个缺陷还
2015-10-10 22:52:48 2138
原创 Container With Most Water
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Fin
2015-05-21 16:11:18 394
原创 Reverse Linked List
Reverse a singly linked list.题意:反转一个链表 比方 1→2→3→4 变成 4→3→2→1自己画的一个图,一图胜千言嗯public ListNode reverseList(ListNode head) { if (null == head) return head; ListNode pre = head; ListNode post
2015-05-16 23:05:24 283
翻译 Triangle leetcode上这道题最详细的解答
原文链接:https://leetcode.com/discuss/5337/dp-solution-for-triangle 写的非常详细自己比较菜不会做但看到这么详细的解释和清晰的思路还是记录一下然后和大家分享下恩(⊙o⊙)…主要是讲了他为什么会用DP而不是DFS,然后分析了从上到下和从下到上两种解法的差别。下面是翻译: 这个问题在我看来结构(well-formed)非
2015-05-14 13:52:52 507
原创 House Robber
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent house
2015-05-13 20:22:44 272
原创 android studio导入项目下载gradle过慢问题
现在无论是android官网的sample还是github上的开源项目,大都是在android studio(AS)上编写的,所以学习的话也绕不开AS了。导入项目的话最痛苦的问题莫过于下载gradle,经常卡在那里然后就不动了你也不知道程序是不是死了。上Google搜解决方案出来的大都是这篇博文吧 http://blog.csdn.net/eclipsexys/article/detail
2015-05-05 20:38:48 4827
原创 Unique Paths
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the
2015-02-01 17:06:40 334
原创 javaweb全站编码过滤器
今天听了朴乾老师讲的关于servlet过滤器的内容,自己跟着实现了一次朴乾老师写的全站过滤器,写篇文章记录下1、把中文乱码问题分成两类,第一类是服务器输出到浏览器的乱码 这个很好解决,直接 response.setContentType("text/html;charset=utf-8");2、第二类是浏览器端传参数到服务器的乱码,又可以分成两小类,get和post p
2015-01-20 22:55:01 678 1
原创 Roman to Integer
题目:Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999.把罗马数字转成Int罗马数字的计数规则可以到百度百科了解下 点击打开链接 不会很难思路:把字符串每一位取出来跟后面一位比较,如果是比后面小则取反因为有这
2015-01-18 14:40:42 268
原创 Populating Next Right Pointers in Each Node
题目:Populate each next pointer to point to its next right
2015-01-12 00:31:24 291
原创 Binary Tree Preorder Traversal
题目:Given a binary tree, return the preorder traversal of its nodes' values.Note: Recursive solution is trivial, could you do it iteratively?非递归先序遍历一棵二叉树之前遇到都是写的递归式的,觉得迭代方式不好理解,然后在discuss里看
2015-01-07 22:20:08 284
原创 Same Tree
题目:Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value.判断两
2014-12-28 20:09:01 286
原创 Single Number 和 Single Number II
题目:Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using
2014-12-27 17:57:55 321
原创 Reverse Integer
Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321要求反转后的数溢出时返回0,比如1000000003 public int reverse(int x) { int sum = 0; while (x != 0) { if (s
2014-12-25 22:24:58 313
原创 Min Stack
leetCodeDesign a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.t
2014-12-24 14:41:08 305
原创 Majority Element
Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element
2014-12-23 20:06:37 321
原创 相邻问题和区域问题
相邻问题使用捆绑法解决问题1: 26个英文字母能组成多少4位数的字符串,其中每位字母都不相同且b和d不相邻? 答案: num = A(26,4) –C(24,2)*3!*2 解析: 先取总的方案数既 A(26, 4) , 再将b、d捆绑看成一个元素, 相当于已经先取了b和d,再从26-2个元素中取2个出来,再对这3个元素进行全排列既3!。注意最后的乘2操作是考虑bd和
2014-11-19 18:04:00 1030
原创 多重排列
问题:“pingpang”8个字母有多少种不同的排列?解析: 有2个p,2个n和2个g,将它们当做p1,p2,n1,n2,g1,g2来看待,则问题蜕化成全排列8!,再分别除以各个重复元素的重复度既三个2!, 可以算出所求排列数多重排列的计算公式记作 A(n: r1, r2, ……rt) = n! / (r1! * r2! …… * rt!)仍旧不太能理解多重排
2014-11-19 18:02:41 669
原创 leetCode Word Search
Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically
2014-10-23 22:39:24 277
空空如也
输入mvn提示堆大小超过最大值
2015-08-03
TA创建的收藏夹 TA关注的收藏夹
TA关注的人