![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
matdodo
use knowledge to make the world better.
展开
-
[leetcode][25]Reverse Nodes in k-Group
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.k is a positive integer and is less than or equal to the length of the linked list. If the number of原创 2017-09-25 00:12:35 · 309 阅读 · 0 评论 -
[leetcode][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 DNA, it is sometimes useful to identify repeated sequences within the DNA.Wri原创 2016-12-28 21:54:08 · 347 阅读 · 0 评论 -
[leetcode][81] Search in Rotated Sorted Array II
Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Suppose an array sorted in ascending order is rotated at原创 2017-01-05 22:59:16 · 622 阅读 · 0 评论 -
[leetcode][155] Min Stack
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get原创 2016-12-28 02:50:52 · 370 阅读 · 0 评论 -
[leetcode][67] Add Binary
Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".class Solution(object): def addBinary(self, a, b): """ :原创 2016-12-28 02:19:37 · 325 阅读 · 0 评论 -
[leetcode][83]Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.# Definition for si原创 2016-12-28 02:14:30 · 270 阅读 · 0 评论 -
[leetcode][98] Validate Binary Search Tree
没睡着,来做题。Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than原创 2016-12-28 02:08:07 · 291 阅读 · 0 评论 -
[leetcode][125]Valid Palindrome
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car" is not a原创 2016-12-27 22:29:52 · 315 阅读 · 0 评论 -
[leetcode][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 sig原创 2016-12-27 21:38:06 · 315 阅读 · 0 评论 -
[leetcode][461]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.Note:0 ≤ x,原创 2017-01-05 23:32:29 · 387 阅读 · 0 评论 -
[leetcode][108]. Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.# Definition for a binary tree node.# class TreeNode(object):# def __init__(self, x):#原创 2016-12-29 10:09:37 · 280 阅读 · 0 评论 -
[leetcode]237. Delete Node in a Linked List
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with value原创 2017-01-18 14:54:56 · 278 阅读 · 0 评论 -
[leetcode][88] Merge Sorted Array
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold add原创 2017-01-15 20:15:27 · 364 阅读 · 0 评论 -
[leetcode][201]. Bitwise AND of Numbers Range
Given a range [m, n] where 0 For example, given the range [5, 7], you should return 4.import mathclass Solution(object): def rangeBitwiseAnd(self, m, n): """ :type m: in原创 2016-12-31 10:34:40 · 353 阅读 · 0 评论 -
[leetcode][350] Intersection of Two Arrays II
Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2].Note:Each element in the result should appear as ma原创 2016-12-30 22:52:33 · 369 阅读 · 0 评论 -
[leetcode][171] Excel Sheet Column Number
Related to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1 B -> 2 C -> 3 ...原创 2016-12-30 14:18:16 · 295 阅读 · 0 评论 -
[leetcode][231] Power of Two
Given an integer, write a function to determine if it is a power of two.class Solution(object): def isPowerOfTwo(self, n): """ :type n: int :rtype: bool原创 2016-12-29 23:14:55 · 316 阅读 · 0 评论 -
[leetcode][18]4Sum
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note: The solution原创 2016-12-29 23:06:13 · 319 阅读 · 0 评论 -
[leetcode][384]. Shuffle an Array
Shuffle a set of numbers without duplicates.Example:// Init an array with set 1, 2, and 3.int[] nums = {1,2,3};Solution solution = new Solution(nums);// Shuffle the array [1,2,3] and return原创 2016-12-29 17:18:04 · 335 阅读 · 0 评论 -
[leetcode][290]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 in pattern and a non-empty word in str.原创 2017-01-03 22:14:22 · 462 阅读 · 0 评论 -
[leetcode][382] Linked List Random Node
Given a singly linked list, return a random node's value from the linked list. Each node must have the same probability of being chosen.Follow up:What if the linked list is extremely large and i原创 2017-01-03 21:37:54 · 362 阅读 · 0 评论 -
[leetcode][462] Minimum Moves to Equal Array Elements II
Given a non-empty integer array, find the minimum number of moves required to make all array elements equal, where a move is incrementing a selected element by 1 or decrementing a selected element by原创 2017-01-02 13:16:02 · 380 阅读 · 0 评论 -
[leetcode299]Bulls and Cows
none原创 2015-11-05 13:28:52 · 774 阅读 · 0 评论 -
[leetcode300] Longest Increasing Subsequence
none原创 2015-11-05 13:37:40 · 788 阅读 · 0 评论 -
[leetcode54] Spiral Matrix
none原创 2015-09-23 21:36:27 · 404 阅读 · 0 评论 -
[leetcode64]Minimum Path Sum
None.............原创 2015-09-25 13:25:23 · 723 阅读 · 0 评论 -
[leetcode]Merge Two Sorted Lists
Merge Two Sorted Lists原创 2015-08-03 08:21:29 · 461 阅读 · 0 评论 -
[leetcode] Remove Duplicates from Sorted Array python
leetcodeGiven a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must d原创 2014-05-17 22:14:16 · 902 阅读 · 0 评论 -
[leetcode] python Remove Duplicates from Sorted Array II
problem:Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array A = [1,1,1,2,2,3],Your function should return length = 5, and A原创 2014-05-20 08:38:43 · 1744 阅读 · 0 评论 -
[leetcode] Search in Rotated Sorted Array Python
Problem:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search. If found in t原创 2014-05-20 10:32:12 · 1779 阅读 · 0 评论 -
[leetcode279] perfect squares
None.....原创 2015-10-06 11:47:21 · 645 阅读 · 0 评论 -
[leetcode292]Nim Game
none...原创 2015-10-23 13:02:50 · 582 阅读 · 0 评论 -
[leetcode297]Serialize and Deserialize Binary Tree
none原创 2015-10-27 13:17:27 · 805 阅读 · 0 评论 -
[leetcode190]Reverse Bits
问题描述:Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 001110010原创 2015-10-24 00:26:54 · 440 阅读 · 0 评论 -
[leetcode284]Peeking Iterator
问题描述:Given an Iterator class interface with methods: next() and hasNext(), design and implement a PeekingIterator that support the peek() operation – it essentially peek() at the element that will be r原创 2015-09-21 13:59:17 · 900 阅读 · 0 评论 -
[leetcode287] Find the Duplicate Number
None原创 2015-11-09 16:53:51 · 747 阅读 · 0 评论 -
[leetcode295]Find Median from Data Stream
问题描述:Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle value.Examples: [2,3,4] , the median原创 2015-10-24 14:39:50 · 550 阅读 · 0 评论 -
[leetcode151] Reverse Words in a String
none...原创 2015-10-24 00:06:10 · 519 阅读 · 0 评论 -
[leetcode126]word ladder 2
word ladder 2Given two words (beginWord and endWord), and a dictionary’s word list, find all shortest transformation sequence(s) from beginWord to endWord, such that:Only one letter can be changed at a原创 2015-09-18 23:42:02 · 630 阅读 · 0 评论 -
[leetcode127]Word Ladder Problem
Word Ladder Problem问题描述: Given two words (beginWord and endWord), and a dictionary’s word list, find the length of shortest transformation sequence from beginWord to endWord, such that:Only one letter原创 2015-09-18 23:16:44 · 468 阅读 · 0 评论