LeetCode解题专栏
LeetCode解题汇总,记录一下自己的思路和代码
mengqingyue
这个作者很懒,什么都没留下…
展开
-
LeetCode解题笔记37 Sudoku Solver
题目:Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character '.'.You may assume that there will be only one unique solution.原创 2018-02-01 23:01:19 · 127 阅读 · 0 评论 -
LeetCode解题笔记45 Jump Game II
原题目:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.You原创 2018-01-17 17:28:39 · 174 阅读 · 0 评论 -
LeetCode解题笔记62 Unique Paths
原题目: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-18 15:33:50 · 120 阅读 · 0 评论 -
LeetCode解题笔记79 Word Search
题目:Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or v原创 2018-01-23 11:24:39 · 130 阅读 · 0 评论 -
LeetCode解题笔记36 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 the character '.'.A partia原创 2018-02-01 23:04:02 · 119 阅读 · 0 评论 -
LeetCode解题笔记136 Single Number
题目:Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without原创 2018-01-23 16:12:49 · 152 阅读 · 0 评论 -
LeetCode解题笔记204 Count Primes
题目:Description:Count the number of prime numbers less than a non-negative number, n.python解法一:思路:当前的数字的倍数都不是素数。class Solution: def countPrimes(self, n): """ :type n原创 2018-02-03 23:56:30 · 117 阅读 · 0 评论 -
LeetCode解题笔记205 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 occurrences of a character must be replaced原创 2018-02-04 00:31:12 · 158 阅读 · 0 评论 -
LeetCode解题笔记212 Word Search II
题目:Given a 2D board and a list of words from the dictionary, find all words in the board.Each word must be constructed from letters of sequentially adjacent cell, where "adjacent" cells are原创 2018-01-23 14:42:48 · 170 阅读 · 0 评论 -
LeetCode解题笔记242 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", t = "car", return false.Note:Yo原创 2018-02-04 00:32:52 · 119 阅读 · 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 app原创 2018-02-04 15:23:29 · 136 阅读 · 0 评论 -
LeetCode解题笔记349 Intersection of Two Arrays
题目:Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].Note:Each element in the result must be uniqu原创 2018-02-04 15:19:42 · 124 阅读 · 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原创 2018-02-04 00:47:08 · 96 阅读 · 0 评论 -
LeetCode解题笔记2 Add Two Numbers
题目:You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers a原创 2018-02-01 18:32:07 · 128 阅读 · 0 评论 -
LeetCode解题笔记1 Two Sum
题目:Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not us原创 2018-02-01 18:21:20 · 129 阅读 · 0 评论