![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
myfwjy
这个作者很懒,什么都没留下…
展开
-
328. Odd Even Linked List
Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.原创 2016-09-04 22:48:07 · 166 阅读 · 0 评论 -
453. Minimum Moves to Equal Array Elements
Given a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a move is incrementing n - 1 elements by 1.原创 2016-11-09 16:46:05 · 1211 阅读 · 0 评论 -
436. Find Right Interval
Given a set of intervals, for each of the interval i, check if there exists an interval j whose start point is bigger than or equal to the end point of the interval i, which can be called that j is on the "right" of i.原创 2016-11-09 17:36:34 · 621 阅读 · 0 评论 -
406. Queue Reconstruction by Height
Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers (h, k), where h is the height of the person and k is the number of people in front of this person who have a height greater than or equal to h. Wri原创 2016-10-07 11:10:36 · 1269 阅读 · 0 评论 -
452. Minimum Number of Arrows to Burst Balloons
There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided input is the start and end coordinates of the horizontal diameter. Since it's horizontal, y-coordinates don't matter and hence the x-coordinates of start a原创 2016-11-10 15:55:37 · 1119 阅读 · 0 评论 -
377. Combination Sum IV
Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer target.原创 2016-11-11 15:59:06 · 149 阅读 · 0 评论 -
423. Reconstruct Original Digits from English
Given a non-empty string containing an out-of-order English representation of digits 0-9, output the digits in ascending order.原创 2016-11-16 16:00:07 · 184 阅读 · 0 评论 -
22. Generate Parentheses
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.原创 2016-11-16 16:32:41 · 162 阅读 · 0 评论 -
202. Happy Number
Write an algorithm to determine if a number is "happy".原创 2016-11-15 16:17:33 · 147 阅读 · 0 评论 -
121.Best Time to Buy and Sell Stock
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 to complete at most one transaction (ie, buy one and sell one share of the stock), design an algorithm to find the maximum profit.原创 2016-11-15 16:43:02 · 166 阅读 · 0 评论 -
419. Battleships in a Board
Given an 2D board, count how many different battleships are in it. The battleships are represented with 'X's, empty slots are represented with '.'s. You may assume the following rules:You receive a valid board, made of only battleships or empty slots.Ba原创 2016-10-18 23:18:47 · 224 阅读 · 0 评论 -
412. Fizz Buzz
Write a program that outputs the string representation of numbers from 1 to n.But for multiples of three it should output “Fizz” instead of the number and for the multiples of five output “Buzz”. For numbers which are multiples of both three and five out原创 2016-10-18 22:38:52 · 180 阅读 · 0 评论 -
404. Sum of Left Leaves
Find the sum of all left leaves in a given binary tree.原创 2016-10-08 20:37:33 · 749 阅读 · 0 评论 -
415. Add Strings
Given two non-negative numbers num1 and num2 represented as string, return the sum of num1 and num2.原创 2016-10-09 18:44:18 · 377 阅读 · 0 评论 -
409. 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.This is case sensitive, for example "Aa" is not considered a palindrome here.原创 2016-10-09 19:38:12 · 390 阅读 · 0 评论 -
401. Binary Watch
A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59).Each LED represents a zero or one, with the least significant bit on the right.转载 2016-10-09 20:25:34 · 309 阅读 · 0 评论 -
230. Kth Smallest Element in a BST
Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.原创 2016-09-08 17:30:00 · 220 阅读 · 0 评论 -
392. Is Subsequence
Given a string s and a string t, check if s is subsequence of t.You may assume that there is only lower case English letters in both s and t. t is potentially a very long (length ~= 500,000) string, and s is a short string (<=100).原创 2016-09-07 22:41:29 · 294 阅读 · 0 评论 -
6. ZigZag Conversion
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)原创 2016-10-10 22:59:54 · 242 阅读 · 0 评论 -
413. Arithmetic Slices
return the number of arithmetic slices in the array A.原创 2016-10-25 14:46:15 · 162 阅读 · 0 评论 -
405. Convert a Number to Hexadecimal
Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used.原创 2016-10-25 15:57:43 · 197 阅读 · 0 评论 -
122.Best Time to Buy and Sell Stock II
Say you have an array for which the ith element is the price of a given stock on day i.原创 2016-08-21 20:31:27 · 196 阅读 · 0 评论 -
216. Combination Sum III
Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers.原创 2016-12-02 16:17:33 · 144 阅读 · 0 评论 -
337. House Robber III
The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides the root, each house has one and only one parent house. After a tour, the smart thief realized that "all houses in this plac原创 2016-12-02 17:10:40 · 192 阅读 · 0 评论 -
231. Power of Two
Given an integer, write a function to determine if it is a power of two.原创 2016-12-15 14:28:18 · 219 阅读 · 0 评论 -
326. Power of Three
Given an integer, write a function to determine if it is a power of three.原创 2016-12-15 14:52:56 · 189 阅读 · 0 评论 -
342. Power of Four
Given an integer (signed 32 bits), write a function to check whether it is a power of 4.原创 2016-12-15 15:31:09 · 263 阅读 · 0 评论 -
448. Find All Numbers Disappeared in an Array
Given 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 appear in this array.Could you do it without extra space and in O(n) runtime? You原创 2016-12-21 16:23:36 · 251 阅读 · 0 评论 -
437. Path Sum III
You 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 the root or a leaf, but it must go downwards (traveling only from parent nodes to chil原创 2016-12-23 14:48:48 · 221 阅读 · 0 评论 -
70. Climbing Stairs
You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?原创 2016-12-26 14:16:02 · 198 阅读 · 0 评论 -
461. Hamming Distance
The Hamming distance between two integers is the number of positions at which the corresponding bits are different.Given two integers x and y, calculate the Hamming distance.原创 2016-12-19 17:48:14 · 223 阅读 · 0 评论 -
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 weight).For example, the 32-bit integer ’11' has binary representation 00000000000000000000000000001011, so the function should return 3.原创 2016-12-27 17:33:26 · 251 阅读 · 0 评论 -
476. Number Complement
Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.原创 2017-01-26 13:19:18 · 171 阅读 · 0 评论 -
459. Repeated Substring Pattern
Given 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 consists of lowercase English letters only and its length will not exceed 10000.原创 2016-12-14 15:57:14 · 295 阅读 · 0 评论 -
113. Path Sum II
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.原创 2016-12-16 17:50:56 · 203 阅读 · 0 评论 -
241. Different Ways to Add Parentheses
Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are +, - and *.原创 2016-12-05 13:53:55 · 163 阅读 · 0 评论 -
434. Number of Segments in a String
Count 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 any non-printable characters.原创 2016-12-05 14:36:17 · 763 阅读 · 0 评论 -
463. 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/vertically (not diagonally). The grid is completely surrounded by water, and there is exactly one island (i.原创 2016-11-23 16:47:20 · 190 阅读 · 0 评论 -
455. Assign Cookies
Assume 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 the minimum size of a cookie that the child will be content with; and each cookie原创 2016-11-23 17:26:17 · 226 阅读 · 0 评论 -
454. 4Sum II
Given four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are such that A[i] + B[j] + C[k] + D[l] is zero.To make problem a bit easier, all A, B, C, D have same length of N where 0 ≤ N ≤ 500. All integers are in the range原创 2016-12-06 17:54:03 · 585 阅读 · 0 评论