2015年4月29日

Number of Islands

摘要: Given a 2d grid map of'1's (land) and'0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent ... 阅读全文

posted @ 2015-04-29 10:57 Step-BY-Step 阅读(182) 评论(0) 推荐(0) 编辑

Bitwise AND of Numbers Range

摘要: Given a range [m, n] where 0 = 0 && (((m >> i) & 1) == ((n >> i) & 1)); i --){5 result |= (((m >> i) & 1) << i);6 }7 retur... 阅读全文

posted @ 2015-04-29 10:39 Step-BY-Step 阅读(146) 评论(0) 推荐(0) 编辑

Happy Number

摘要: Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer... 阅读全文

posted @ 2015-04-29 10:06 Step-BY-Step 阅读(161) 评论(0) 推荐(0) 编辑

Remove Linked List Elements

摘要: Remove all elements from a linked list of integers that have valueval.ExampleGiven:1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6,val= 6Return:1 --> 2 --> 3 --... 阅读全文

posted @ 2015-04-29 10:05 Step-BY-Step 阅读(133) 评论(0) 推荐(0) 编辑

Count Primes

摘要: Description:Count the number of prime numbers less than a non-negative number,n 1 public class Solution { 2 public int countPrimes(int n) { 3 ... 阅读全文

posted @ 2015-04-29 10:04 Step-BY-Step 阅读(316) 评论(0) 推荐(0) 编辑

Isomorphic Strings

摘要: Given two stringssandt, determine if they are isomorphic.Two strings are isomorphic if the characters inscan be replaced to gett.All occurrences of a ... 阅读全文

posted @ 2015-04-29 09:59 Step-BY-Step 阅读(120) 评论(0) 推荐(0) 编辑

导航