- 博客(306)
- 资源 (1)
- 收藏
- 关注
原创 482. License Key Formatting(easy)
Easy334571FavoriteShareYou are given a license key represented as a string S which consists only alphanumeric character and dashes. The string is separated into N+1 groups by N dashes.Given a nu...
2019-11-22 08:58:12
272
原创 476. Number Complement(easy)
Easy58876FavoriteShareGiven a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.Note:The given integer is guaranteed to f...
2019-11-22 08:56:21
236
原创 475. Heaters(easy)
Easy535577FavoriteShareWinter is coming! Your first job during the contest is to design a standard heater with fixed warm radius to warm all the houses.Now, you are given positions of houses and...
2019-11-22 08:54:51
298
原创 463. Island Perimeter(easy)
Easy122889FavoriteShareYou 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/vertically (not diagonal...
2019-11-22 08:53:09
221
原创 461. Hamming Distance(easy)
Easy1400133FavoriteShareTheHamming distancebetween two integers is the number of positions at which the corresponding bits are different.Given two integersxandy, calculate the Hamming dista...
2019-11-22 08:51:56
198
原创 459. Repeated Substring Pattern(easy)
Easy906105FavoriteShareGiven a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may assume the given string ...
2019-11-22 08:50:42
155
原创 455. Assign Cookies(easy)
Easy36369FavoriteShareAssume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor gi, which is...
2019-11-22 08:48:32
163
原创 453. Minimum Moves to Equal Array Elements(easy)
Easy412636FavoriteShareGiven anon-emptyinteger array of sizen, find the minimum number of moves required to make all array elements equal, where a move is incrementingn- 1 elements by 1.Exa...
2019-11-22 08:46:47
151
原创 448. Find All Numbers Disappeared in an Array(easy)
Easy1875175FavoriteShareGiven an array of integers where 1 ≤ a[i] ≤n(n= size of array), some elements appear twice and others appear once.Find all the elements of [1,n] inclusive that do not...
2019-11-22 08:45:27
161
原创 447. Number of Boomerangs(easy)
Easy318500FavoriteShareGivennpoints in the plane that are all pairwise distinct, a "boomerang" is a tuple of points(i, j, k)such that the distance betweeniandjequals the distance betweeni...
2019-11-22 08:43:46
161
原创 443. String Compression(easy)
Easy4461416FavoriteShareGiven an array of characters, compress itin-place.The length after compression must always be smaller than or equal to the original array.Every element of the array sh...
2019-11-19 20:29:52
189
原创 441. Arranging Coins(easy)
Easy222499FavoriteShareYou have a total ofncoins that you want to form in a staircase shape, where everyk-th row must have exactlykcoins.Givenn, find the total number offullstaircase row...
2019-11-19 20:27:01
150
原创 437. Path Sum III(easy)
Easy2197126FavoriteShareYou are given a binary tree in which each node contains an integer value.Find the number of paths that sum to a given value.The path does not need to start or end at th...
2019-11-19 20:25:42
210
原创 434. Number of Segments in a String(easy)
Easy154607FavoriteShareCount the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space characters.Please note that the string does not contain anyn...
2019-11-19 20:23:54
211
原创 429. N-ary Tree Level Order Traversal(easy)
Easy32635FavoriteShareGiven an n-ary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example, given a3-arytree: We should re...
2019-11-19 20:21:08
199
原创 415. Add Strings(easy)
Easy505172FavoriteShareGiven two non-negative integersnum1andnum2represented as string, return the sum ofnum1andnum2.Note:The length of bothnum1andnum2is < 5100. Bothnum1andn...
2019-11-19 20:18:46
147
原创 414. Third Maximum Number(easy)
Easy430810FavoriteShareGiven anon-emptyarray of integers, return thethirdmaximum number in this array. If it does not exist, return the maximum number. The time complexity must be in O(n).Ex...
2019-11-19 20:17:40
204
1
原创 412. Fizz Buzz(easy)
Easy597876FavoriteShareWrite a program that outputs the string representation of numbers from 1 ton.But for multiples of three it should output “Fizz” instead of the number and for the multiple...
2019-11-19 20:16:21
143
原创 409. Longest Palindrome(easy)
Easy61164FavoriteShareGiven a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters.This is case sensitive, for...
2019-11-19 20:15:12
199
原创 405. Convert a Number to Hexadecimal(easy)
Easy31379FavoriteShareGiven an integer, write an algorithm to convert it to hexadecimal. For negative integer,two’s complementmethod is used.Note:All letters in hexadecimal (a-f) must be in ...
2019-11-19 20:13:56
192
原创 404. Sum of Left Leaves(easy)
Easy75084FavoriteShareFind the sum of all left leaves in a given binary tree.Example: 3 / \ 9 20 / \ 15 7There are two left leaves in the binary tree, with values 9...
2019-11-12 14:09:11
155
原创 401. Binary Watch(easy)
Easy410692FavoriteShareA binary watch has 4 LEDs on the top which represent thehours(0-11), and the 6 LEDs on the bottom represent theminutes(0-59).Each LED represents a zero or one, with th...
2019-11-12 14:01:06
173
原创 392. Is Subsequence(easy)
Easy678142FavoriteShareGiven a stringsand a stringt, check ifsis subsequence oft.You may assume that there is only lower case English letters in bothsandt.tis potentially a very long ...
2019-11-12 13:59:10
186
原创 389. Find the Difference(easy)
Easy559244FavoriteShareGiven two stringssandtwhich consist of only lowercase letters.Stringtis generated by random shuffling stringsand then add one more letter at a random position.Fi...
2019-11-12 13:56:22
166
原创 387. First Unique Character in a String(easy)
Easy118886FavoriteShareGiven a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1.Examples:s = "leetcode"return 0.s = "loveleetco...
2019-11-12 13:54:42
167
原创 383. Ransom Note(easy)
Easy359136FavoriteShareGiven an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the ransom note can be construc...
2019-11-12 13:53:02
173
原创 374. Guess Number Higher or Lower(easy)
Easy2621299FavoriteShareWe are playing the Guess Game. The game is as follows:I pick a number from1ton. You have to guess which number I picked.Every time you guess wrong, I'll tell you ...
2019-11-12 13:50:46
171
原创 371. Sum of Two Integers(easy)
Easy8511578FavoriteShareCalculate the sum of two integersaandb, but you arenot allowedto use the operator+and-.Example 1:Input: a = 1, b = 2Output: 3Example 2:Input: a = -2, b...
2019-11-12 13:49:59
173
原创 367. Valid Perfect Square(easy)
Easy516114FavoriteShareGiven a positive integernum, write a function which returns True ifnumis a perfect square else False.Note:Do notuse any built-in library function such assqrt.Examp...
2019-11-12 13:48:27
208
原创 350. Intersection of Two Arrays II(easy)
Easy809287FavoriteShareGiven two arrays, write a function to compute their intersection.Example 1:Input: nums1 = [1,2,2,1], nums2 = [2,2]Output: [2,2]Example 2:Input: nums1 = [4,9,5], nu...
2019-11-12 13:46:38
176
原创 349. Intersection of Two Arrays(easy)
Easy470881FavoriteShareGiven two arrays, write a function to compute their intersection.Example 1:Input: nums1 = [1,2,2,1], nums2 = [2,2]Output: [2]Example 2:Input: nums1 = [4,9,5], nums...
2019-11-01 08:33:02
181
原创 345. Reverse Vowels of a String(easy)
Easy433818FavoriteShareWrite a function that takes a string as input and reverse only the vowels of a string.Example 1:Input: "hello"Output: "holle"Example 2:Input: "leetcode"Output: "...
2019-11-01 08:31:40
159
原创 344. Reverse String(easy)
Easy863559FavoriteShareWrite a function that reverses a string. The input string is given as an array of characterschar[].Do not allocate extra space for another array, you must do this bymodi...
2019-11-01 08:30:13
154
原创 342. Power of Four(easy)
Easy341158FavoriteShareGiven an integer (signed 32 bits), write a function to check whether it is a power of 4.Example 1:Input: 16Output: trueExample 2:Input: 5Output: falseFollow up...
2019-11-01 08:28:38
202
原创 326. Power of Three(easy)
Easy3241153FavoriteShareGiven an integer, write a function to determine if it is a power of three.Example 1:Input: 27Output: trueExample 2:Input: 0Output: falseExample 3:Input: 9...
2019-11-01 08:27:14
128
原创 303. Range Sum Query – Immutable(easy)
Easy537837FavoriteShareGiven an integer arraynums, find the sum of the elements between indicesiandj(i≤j), inclusive.Example:Given nums = [-2, 0, 3, -5, 2, -1]sumRange(0, 2) -> 1...
2019-10-30 09:59:26
157
原创 299. Bulls and Cows(easy)
Easy386404FavoriteShareYou are playing the followingBulls and Cowsgame with your friend: You write down a number and ask your friend to guess what the number is. Each time your friend makes a gu...
2019-10-30 09:57:39
185
原创 292. Nim Game(easy)
Easy4071217FavoriteShareYou are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who remove...
2019-10-30 09:55:39
554
原创 290. Word Pattern(easy)
Easy73093FavoriteShareGiven apatternand a stringstr, find ifstrfollows the same pattern.Herefollowmeans a full match, such that there is a bijection between a letter inpatternand anon-...
2019-10-30 09:54:23
166
原创 283. Move Zeroes(easy)
Easy231983FavoriteShareGiven an arraynums, write a function to move all0's to the end of it while maintaining the relative order of the non-zero elements.Example:Input: [0,1,0,3,12]Output:...
2019-10-30 09:52:38
162
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人