自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(7)
  • 收藏
  • 关注

原创 Remove Linked List Elements

/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */ public class Solution { public ListNode remov

2015-05-16 21:34:41 213 2

原创 LeetCode-Count Prime

一天一题埃拉托斯筛选法:http://en.wikipedia.org/wiki/Sieve_of_Eratosthenespublic class Solution { public int countPrimes(int n) { boolean notPrime[] = new boolean[n]; int count = 0;

2015-05-15 20:49:42 313

原创 LeetCode-isIsomorphic String

第一种简单方法:public class Solution { public boolean isIsomorphic(String s, String t) { HashMap<Character, Character> myMap = new HashMap<Character, Character>(); for(int i=0; i<s.length(); i

2015-05-13 18:18:50 256

原创 Leetcode-Reverse Integer

*做的时候没有掌握好count的最大值与最小值问题, 最后count输出时没有强制转换成int,导致出错!*/* Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 */ public class Solution { public int reverse(

2015-05-11 18:47:16 230

原创 Leetcode-Reverse Bits

No.2二进制的移位思想public class Solution { public int reverseBits(int n) { int count = 0; for(int i=0; i<32; i++) { count = 2*count + (n & 1); n = n>>>1; }

2015-05-11 18:14:27 232

原创 Leetcode the number of '1' bit

计算无符号整形数中 the number of ‘1’ bit, 这道题很基础,用到几个运算符,&,>>>第一种利用java函数法/* Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For exa

2015-05-11 16:12:44 229

原创 Leetcode Happy Number

一天一题~充实自己/* ** A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until

2015-05-10 12:42:57 181

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除