原创 198. House Robber
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed,
原创 217, 219,220. Contains Duplicate I, II, III
Given an array of integers, find if the array contains any duplicates. Your function should return true if any value a
原创 200. 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 an
原创 201. Bitwise AND of Numbers Range
Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive.
原创 207,210. Course Schedule I, II
Course Schedule I There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have p
原创 283. Move Zeroes
Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the no
原创 206. Reverse Linked List
Reverse a singly linked list. /** * Definition for singly-linked list. * public class ListNode { * int val; *
原创 204. Count Primes
Description: Count the number of prime numbers less than a non-negative number, n. 思路: 從前向後掃描,第一次遇到沒標記的應該是沒有因子的質數。然後
原创 205. Isomorphic Strings
Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be
原创 191. Number of 1 Bits
Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming
原创 190. Reverse Bits
Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 0000001
原创 121.122.123.188. Best Time to Buy and Sell Stock I II III IV
Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted
原创 202. Happy Number
Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process:
原创 187. Repeated DNA Sequences
All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying
原创 203. Remove Linked List Elements
Remove all elements from a linked list of integers that have value val. ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5