摘要:
public class Solution { public boolean isHappy(int n) { boolean res=false; Map mp=new HashMap(); int temp=n; while(true) { int sum=0; ...
阅读全文
posted @ 2016-04-03 10:28
阿怪123
阅读(79)
推荐(0)
摘要:
public class Solution { public int rob(int[] nums) { int len=nums.length; if(len==0) return 0; int[] money=new int[len]; for(int i=0;i=(mo2+num...
阅读全文
posted @ 2016-04-03 10:16
阿怪123
阅读(107)
推荐(0)
摘要:
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */ public class Solution { public ListNode rem...
阅读全文
posted @ 2016-04-02 21:04
阿怪123
阅读(87)
推荐(0)
摘要:
public class Solution { public boolean containsDuplicate(int[] nums) { Map mp=new HashMap(); int len=nums.length; for(int i=0;i<len;i++) { if(mp.contai...
阅读全文
posted @ 2016-04-02 20:38
阿怪123
阅读(116)
推荐(0)
摘要:
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution { ...
阅读全文
posted @ 2016-04-02 20:32
阿怪123
阅读(119)
推荐(0)
摘要:
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution { ...
阅读全文
posted @ 2016-04-02 20:25
阿怪123
阅读(120)
推荐(0)
摘要:
罗马数字主要特点: I V X L C D M 1 5 10 50 100 500 1000 1 基本数字,I,X,C。自身连用构成数目、或者放大在大数的右边连用构成数目、不可以超过三个;放在大数左边不能超过一个 2 基本数字 V L D 不可以作为小数放在大数左边来作为减数。放在大数的右边采用想家
阅读全文
posted @ 2016-04-02 19:56
阿怪123
阅读(101)
推荐(0)
摘要:
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */ public class Solution { public ListNode ins...
阅读全文
posted @ 2016-04-02 17:20
阿怪123
阅读(108)
推荐(0)
摘要:
public class Solution { public boolean isPalindrome(String s) { List my=new ArrayList(); int len=s.length(); for(int i=0;i='a'&&temp='0'&&temp='A'&&temp<='Z') ...
阅读全文
posted @ 2016-04-02 16:36
阿怪123
阅读(99)
推荐(0)
摘要:
public class Solution { public int findPeakElement(int[] nums) { int length=nums.length; if(length==1) return 0; int i=0; for(;inums[...
阅读全文
posted @ 2016-04-02 14:52
阿怪123
阅读(67)
推荐(0)
摘要:
class MyQueue { // Push element x to the back of queue. public void push(int x) { stin.push(x); } // Removes the element from in front of queue. public void pop() { ...
阅读全文
posted @ 2016-04-02 14:42
阿怪123
阅读(136)
推荐(0)
摘要:
第一次尝试用暴力比较法,超时 之后选择用hashmap的方法,节省时间复杂度
阅读全文
posted @ 2016-04-02 11:38
阿怪123
阅读(113)
推荐(0)
摘要:
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution { ...
阅读全文
posted @ 2016-04-02 11:16
阿怪123
阅读(130)
推荐(0)
摘要:
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution { ...
阅读全文
posted @ 2016-04-02 11:11
阿怪123
阅读(105)
推荐(0)
摘要:
public class Solution { public boolean isPowerOfTwo(int n) { if(n<=0) return false; else if(n==1) return true; int temp=n; int count=0; ...
阅读全文
posted @ 2016-04-02 10:34
阿怪123
阅读(150)
推荐(0)
摘要:
根据罗马数字的写法,连续出现2个或3个相同字母的情况一定是其左边有一个大数或者相等的数。即是 III 或者 VII不存在 IIV这种写法,即不允许有连续减去两个小数的写法。
阅读全文
posted @ 2016-04-01 22:13
阿怪123
阅读(138)
推荐(0)
摘要:
先遍历两个链表,发现较短的那个,之后再把长的list进行去头操作。 得到两个等长的list,之后进行比较,如果有相同的val的node,则记录这个node,之后再向后进行比较。 如果发现有node存在不同,则直接返回null,如果走到尾都没有发现不同的node,则返回当初记录的那个node JAVA
阅读全文
posted @ 2016-04-01 20:18
阿怪123
阅读(187)
推荐(0)
摘要:
1 public class MaximumDepthofBinaryTree104 2 { 3 public int maxDepth(TreeNode root) { 4 int res=0; 5 6 Queue q1=new LinkedList(); 7 if(root==null) 8 ...
阅读全文
posted @ 2016-04-01 19:56
阿怪123
阅读(172)
推荐(0)
摘要:
Windows Live Writer is a desktop application that makes it easy to publish content to your blog. I've been using Windows Live Writer for a long time to write my blog entries for the various websites I...
阅读全文
posted @ 2016-03-30 15:08
阿怪123
阅读(123)
推荐(0)
摘要:
以如下代码为例: 其中设置了返回值类型resultClass为整数类型,keyProperty设置数据源。 之后通过一条简单的嵌套查询语句可以查询到新添加的最新的行,取keyProperty设置的条目作为返回值 2. 在dao层中添加函数 之后调用函数即可得到需要的主键id作为返回值了。
阅读全文
posted @ 2016-03-30 14:19
阿怪123
阅读(2326)
推荐(0)
摘要:
主要注意的是精读判断问题,使用round()函数进行四舍五入的取整数 判断精读的是方法是使用一个static的变量 double epsilon = 10e-15; 之后用abs()函数判断两个数之差是否在这个范围内即可。 #include <cmath> class Solution { publ
阅读全文
posted @ 2016-03-05 21:41
阿怪123
阅读(104)
推荐(0)
摘要:
1.定义介绍(1).XML定义扩展标记语言 (Extensible Markup Language, XML) ,用于标记电子文件使其具有结构性的标记语言,可以用来标记数据、定义数据类型,是一种允许用户对自己的标记语言进行定义的源语言。 XML使用DTD(document type definiti...
阅读全文
posted @ 2015-12-28 15:05
阿怪123
阅读(167)
推荐(0)
摘要:
fat tree架构下,网络带宽不收敛传统的树形网络拓扑中,带宽是逐层收敛的,树根处的带宽要远小于叶子处所有带宽的总和fat tree网络则更像是真实的树,越到树根,枝干越粗。即是:从叶子到树根,网络带宽不收敛。这是fat tree架构能够支撑无阻塞网络的基础
阅读全文
posted @ 2015-12-14 15:44
阿怪123
阅读(2105)
推荐(0)
摘要:
https://leetcode.com/problems/merge-sorted-array/ 1 class Solution { 2 public: 3 void merge(vector& nums1, int m, vector& nums2, int n) { 4 ...
阅读全文
posted @ 2015-12-11 17:49
阿怪123
阅读(108)
推荐(0)
摘要:
https://leetcode.com/problems/binary-tree-paths//** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * ...
阅读全文
posted @ 2015-12-08 16:24
阿怪123
阅读(98)
推荐(0)
摘要:
https://leetcode.com/problems/implement-stack-using-queues/class Stack {public: queue q1,q2; // Push element x onto stack. void push(int x) {...
阅读全文
posted @ 2015-12-08 16:06
阿怪123
阅读(104)
推荐(0)
摘要:
https://leetcode.com/problems/path-sum-ii//** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * Tree...
阅读全文
posted @ 2015-12-08 15:31
阿怪123
阅读(116)
推荐(0)
摘要:
https://leetcode.com/problems/path-sum/使用递归的方法/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * ...
阅读全文
posted @ 2015-12-08 15:02
阿怪123
阅读(110)
推荐(0)
摘要:
https://leetcode.com/problems/plus-one/class Solution {public: vector plusOne(vector& digits) { int size=digits.size(); vector::itera...
阅读全文
posted @ 2015-12-08 00:35
阿怪123
阅读(132)
推荐(0)
摘要:
https://leetcode.com/problems/add-digits/class Solution {public: int addDigits(int num) { int res=num; while(oneDigit(res)==false) ...
阅读全文
posted @ 2015-12-07 23:33
阿怪123
阅读(107)
推荐(0)
摘要:
https://leetcode.com/problems/missing-number/class Solution {public: int missingNumber(vector& nums) { int size=nums.size(); int * my...
阅读全文
posted @ 2015-12-07 22:14
阿怪123
阅读(123)
推荐(0)
摘要:
https://leetcode.com/problems/h-index-ii/ 1 class Solution { 2 public: 3 int hIndex(vector& citations) { 4 int size=citations.size(); 5 ...
阅读全文
posted @ 2015-12-06 22:25
阿怪123
阅读(178)
推荐(0)
摘要:
https://leetcode.com/problems/h-index/class Solution {public: int hIndex(vector& citations) { int size=citations.size(); int index=si...
阅读全文
posted @ 2015-12-06 16:24
阿怪123
阅读(140)
推荐(0)
摘要:
https://leetcode.com/problems/ugly-number-ii/第N个丑数,用暴力法导致,从1开始逐个验证是否是丑数,然后一直到找到第N个丑数,这个方法会超时。因为,当数字增大到一定的情况的时候,每个丑数之间的间隔是以指数倍增加的,导致了遍历的方法会在 i++ 的过程中耗费...
阅读全文
posted @ 2015-12-05 17:35
阿怪123
阅读(216)
推荐(0)
摘要:
https://leetcode.com/problems/ugly-number/class Solution {public: bool isUgly(int num) { if(num<=0) return false; if(num==...
阅读全文
posted @ 2015-12-05 16:27
阿怪123
阅读(121)
推荐(0)
摘要:
我们已经讲过了,字符串也是一种数据类型,但是,字符串比较特殊的是还有一个编码问题。因为计算机只能处理数字,如果要处理文本,就必须先把文本转换为数字才能处理。最早的计算机在设计时采用8个比特(bit)作为一个字节(byte),所以,一个字节能表示的最大的整数就是255(二进制11111111=十进制2...
阅读全文
posted @ 2015-12-01 09:35
阿怪123
阅读(167)
推荐(0)
摘要:
HTTPS其实是有两部分组成:HTTP +SSL/ TLS,也就是在HTTP上又加了一层处理加密信息的模块。服务端和客户端的信息传输都会通过TLS进行加密,所以传输的数据都是加密后的数据1. 客户端发起HTTPS请求这个没什么好说的,就是用户在浏览器里输入一个https网址,然后连接到server的...
阅读全文
posted @ 2015-11-04 14:38
阿怪123
阅读(626)
推荐(0)
摘要:
%QThis is an alternative for double-quoted strings, when you have more quote characters in a string.Instead of putting backslashes in front of them, y...
阅读全文
posted @ 2015-10-20 19:08
阿怪123
阅读(682)
推荐(0)
摘要:
为什么国外程序员爱用 Mac?fromhttp://www.vpsee.com/2009/06/why-programmers-love-mac/Mac 在国外很受欢迎,尤其是在 设计/web开发/IT 人员圈子里。普通用户喜欢 Mac 可以理解,毕竟 Mac 设计美观,简单好用,没有病毒。那么为什...
阅读全文
posted @ 2015-10-09 12:25
阿怪123
阅读(6938)
推荐(0)
摘要:
路由是双向的,所以由网络封包发送处发送到目标的路由规划,必须要考虑回程时是否具有相对的路由, 否则该封包可能会『遗失』;A ping B的情况下:ping通:只有这一种情况算ping通,即是封包能够到达,并且能够以到达的路径完全相同的路径返回并且也能成功。 A→C→D→B→D→C→Aping不通:...
阅读全文
posted @ 2015-09-24 15:05
阿怪123
阅读(334)
推荐(0)