
HashMap
pengweixuan008
这个作者很懒,什么都没留下…
展开
-
217.Contains Duplicate(判断一个数组是否有重复数出现)
题目:Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every eleme原创 2015-07-28 15:57:55 · 337 阅读 · 0 评论 -
204.Count Primes(1-N中,素数的个数)
题目:Count the number of prime numbers less than a non-negative number, n.代码:public class Solution { public int countPrimes(int n) { boolean [] a = new boolean[n]; int cou原创 2015-07-28 16:20:25 · 257 阅读 · 0 评论 -
202.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 the number equ原创 2015-07-29 11:06:49 · 264 阅读 · 0 评论 -
13.Roman to Integer (罗马数字转成整数)
public class Solution { public int romanToInt(String s) { char[] symbol = { 'I', 'V', 'X', 'L', 'C', 'D', 'M' }; int[] val = { 1, 5, 10, 50, 100, 500, 1000 }; Map map =原创 2015-08-03 14:32:24 · 279 阅读 · 0 评论