题目描述 There are a total of n courses you have to take, labeled from 0 to n – 1. Some courses may have pre…
分类:LeetCode
[Leetcode] Palindrome Linked List 回文链表
Palindrome Linked List Given a singly linked list, determine if it is a palindrome. Follow up: Could you do it…
【leetcode】5. Longest Palindromic Substring 最长回文子串
1. 题目 Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of…
LeetCode 188. Best Time to Buy and Sell Stock IV
Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to…
Longest Valid Parentheses 解题报告
原题:Given a string containing just the characters ‘(‘ and ‘)’, find the length of the l…
递归——求阶乘
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书 1. 递归 一个函数调用其自身,就是递归。 2. 求阶乘 问题描述 求n的阶乘,n>=0…
力扣(LeetCode) -148 排序链表
本题考察的归并排序(或插入排序)和链表操作 题目描述 在 O(n log n) 时间复杂度和常数级空间复杂度下,对链表进行排序。 示例1: 输入: 4->2->1->3 输出: 1->2->…
LeetCode刷题之路 模糊坐标
模糊坐标【中等】 我们有一些二维坐标,如 "(1, 3)" 或 "(2, 0.5)",然后我们移除所有逗号,小数点和空格,得到一个字符串S。返回所有可能的原始字符串到一个列表中。 原始的坐标表示法不会存在多余的零,所以不…
Day.5 Single Number(136)
问题描述 Given an array of integers, every element appears twice except for one. Find that single one. 思路:利用0和任何数异…
LeetCode刷题之Search Insert Position
Problem Given a sorted array and a target value, return the index if the target is found. If not, return the i…
10. Regular Expression Matching(hard)
10. Regular Expression Matching 题目 Implement regular expression matching with support for '.' and '*'. '.' Mat…
[LeetCode] Binary Tree Preorder Traversal 二叉树的先序遍历
Given a binary tree, return the preorder traversal of its nodes’ values. For example:Gi…