Given a non-empty string s and a dictionary wordDict containing a list of…
分类:LeetCode
LeetCode 283 Move Zeroes
题目描述 Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative ord…
LeetCode 022 Generate Parentheses
题目描述 Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. F…
1.Two Num
#coding: utf-8 """ 1. Two Sum Given an array of integers, return indices of the two numbers such that they add…
242. 有效的字母异位词
一、题目原型: 给定两个字符串 s 和 t ,编写一个函数来判断 t 是否是 s 的一个字母异位词。 二、示例剖析: 示例 1: 输入: s = "anagram", t = "nagaram" 输出: true 示例 …
LeetCode 的 Python 实现 70: 爬楼梯问题
假设你正在爬楼梯。需要 n 阶你才能到达楼顶。 每次你可以爬 1 或 2 个台阶。你有多少种不同的方法可以爬到楼顶呢? 注意:给定 n 是一个正整数。 爬楼梯问题的实质就是 斐波那契数列 f(n) = f(n-1) + …
2019-03-22
难度 具体代码 我的代码的优点, 分情况考虑问题, 代码清晰. 注意事项 就是如果在某一点dp[i-1][j] == False 那么 dp[i][j]就要受到影响, 应该也是False class Solution(o…
[LeetCode] Remove Duplicates from Sorted List II 移除有序链表中的重复项之二
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct&nb…
[LeetCode] Basic Calculator 基本计算器
Implement a basic calculator to evaluate a simple expression string. The expression string may contain …
LeetCode | Wildcard Matching
题目: Implement wildcard pattern matching with support for '?' and '*'. '?' Matches any single ch…
LeetCode | Reverse Linked List II
题目: Reverse a linked list from position m to n. Do it in-place and in one-pass. For example: Gi…
LeetCode 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. Design an algorit…