![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
yufengsong09
热爱技术,热爱生活
展开
-
LeetCode---69. Sqrt(x)---Python实现
Implement int sqrt(int x).Compute and return the square root of x.x is guaranteed to be a non-negative integer.Example 1:Input: 4Output: 2Example 2:Input: 8Output: 2Explanation: Th原创 2018-01-22 15:33:58 · 703 阅读 · 0 评论 -
LeetCode 78. Subsets--Python实现
Given a set of distinct integers, nums, return all possible subsets (the power set).Note: The solution set must not contain duplicate subsets.For example,If nums = [1,2,3], a solution is:[ [3], [1...原创 2018-01-29 17:24:41 · 568 阅读 · 0 评论 -
LeetCode 77. Combinations--python实现
Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4],]原创 2018-01-29 11:53:27 · 300 阅读 · 0 评论 -
LeetCode 30. Substring with Concatenation of All Words----Python实现
You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a concatenation of each word in words exactly once and原创 2018-01-29 02:03:46 · 301 阅读 · 0 评论 -
LeetCode 3. Longest Substring Without Repeating Characters---Python实现
Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the answer is "原创 2018-01-29 01:53:53 · 139 阅读 · 0 评论 -
LeetCode 76. Minimum Window Substring--Python实现
Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S = "ADOBECODEBANC"T = "ABC"Minimum window is "BAN原创 2018-01-29 01:45:09 · 244 阅读 · 0 评论 -
LeetCode 57. Insert Interval---Python实现
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times.E原创 2018-01-08 16:54:46 · 404 阅读 · 0 评论 -
LeetCode 65. Valid Number--Python实现
Validate if a given string is numeric.Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => trueNote: It is intended for the problem statement to be ambiguo原创 2018-01-16 15:55:17 · 559 阅读 · 0 评论 -
LeetCode 63. Unique Paths II--Python实现
Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 and 0 respectively in the原创 2018-01-16 15:01:22 · 253 阅读 · 0 评论 -
LeetCode 51. N-Queens--Python实现
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all distinct solutions to the n-queens puzzle.原创 2018-01-16 09:37:53 · 1684 阅读 · 0 评论 -
LeetCode 64. Minimum Path Sum---Python实现
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down or right at原创 2018-01-16 15:13:29 · 182 阅读 · 0 评论 -
LeetCode 62.Unique Paths---Python实现
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the原创 2018-01-16 14:48:40 · 761 阅读 · 0 评论 -
LeetCode 61. Rotate List---Python实现
Given a list, rotate the list to the right by k places, where k is non-negative.Example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL.本题关键在于构建一个循环链表,注意k要对链表长度取余。# Defi原创 2018-01-16 14:33:23 · 140 阅读 · 0 评论 -
LeetCode 72. Edit Distance-----Python实现
Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitted on a word:原创 2018-01-24 00:18:53 · 245 阅读 · 0 评论 -
LeetCode 70 Climbing Stairs--Python实现
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?Note: Given n will be a positive原创 2018-01-22 16:36:58 · 197 阅读 · 0 评论 -
407. Trapping Rain Water II(python shixian)
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.The above elevation map is represented by array [0...原创 2018-05-28 20:31:14 · 281 阅读 · 0 评论