
LeetCode-Hash
文章平均质量分 52
R_zz
这个作者很懒,什么都没留下…
展开
-
LeetCode-Hash-205. Isomorphic Strings
问题:https://leetcode.com/problems/isomorphic-strings/ Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occu原创 2017-01-13 20:34:03 · 269 阅读 · 0 评论 -
LeetCode-Hash-447. Number of Boomerangs
问题:https://leetcode.com/problems/number-of-boomerangs/ Given n points in the plane that are all pairwise distinct, a “boomerang” is a tuple of points (i, j, k) such that the distance between i and j e原创 2017-01-12 21:36:23 · 205 阅读 · 0 评论 -
LeetCode-Hash-202. Happy Number
问题:https://leetcode.com/problems/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,原创 2017-01-12 21:05:10 · 245 阅读 · 0 评论 -
LeetCode-Hash-290. Word Pattern
问题:https://leetcode.com/problems/word-pattern/ Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a letter原创 2017-01-17 16:45:32 · 188 阅读 · 0 评论 -
LeetCode-Hash-299. Bulls and Cows
问题:https://leetcode.com/problems/bulls-and-cows/ You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each time原创 2017-01-17 14:54:19 · 192 阅读 · 0 评论 -
LeetCode-Hash-136. Single Number
问题:https://leetcode.com/problems/single-number/ Given an array of integers, every element appears twice except for one. Find that single one. 分析:使用异或位运算符。相同为0,不同为1。如果有两个数均为5,它的的二进制均为0101,两者异或,0101^01原创 2017-01-16 21:54:35 · 504 阅读 · 0 评论 -
LeetCode-Hash-242. Valid Anagram
问题:https://leetcode.com/problems/valid-anagram/ Given two strings s and t, write a function to determine if t is an anagram of s. For example, s = “anagram”, t = “nagaram”, return true. s = “rat”,原创 2017-01-16 20:59:25 · 181 阅读 · 0 评论 -
LeetCode-Hash-463. Island Perimeter
问题:https://leetcode.com/problems/island-perimeter/ You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/v原创 2017-01-16 21:32:31 · 261 阅读 · 0 评论 -
LeetCode-Hash-438. Find All Anagrams in a String
问题:https://leetcode.com/problems/find-all-anagrams-in-a-string/ Given a string s and a non-empty string p, find all the start indices of p’s anagrams in s. Strings consists of lowercase English lette原创 2017-01-11 21:12:24 · 233 阅读 · 0 评论 -
LeetCode-Hash-409. Longest Palindrome
问题:https://leetcode.com/problems/longest-palindrome/ Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters.原创 2017-01-11 20:43:12 · 217 阅读 · 0 评论 -
LeetCode-Hash-349. Intersection of Two Arrays && 350. Intersection of Two Arrays II
问题349:https://leetcode.com/problems/intersection-of-two-arrays/Given two arrays, write a function to compute their intersection.问题350:https://leetcode.com/problems/intersection-of-two-arrays-ii/原创 2017-01-11 11:24:01 · 247 阅读 · 0 评论 -
LeetCode-Hash-204. Count Primes
问题:https://leetcode.com/problems/count-primes/Countthe number of prime numbers less than a non-negative number, n.分析:埃拉托斯特尼筛法。找出所有的素数。素数最小是2,先把2以及2的倍数剔除去。再把3以及3的倍数剔除出去。注意三个小问题:(1)首先我们该用i*i代码:c原创 2017-01-13 21:12:17 · 222 阅读 · 0 评论 -
LeetCode-Hash-36. Valid Sudoku
问题:https://leetcode.com/problems/valid-sudoku/ Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. The Sudoku board could be partially filled, where empty cells are filled with原创 2017-01-17 17:32:11 · 213 阅读 · 0 评论