文章 2023-05-21 来自:开发者社区

Python 刷Leetcode题库,顺带学英语单词(5)

Valid ParenthesesGiven a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.  [#20]An input string is valid if:Open brackets must be cl....

文章 2023-05-21 来自:开发者社区

Python 刷Leetcode题库,顺带学英语单词(4)

Letter Combinations of a Phone NumberGiven a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent.A mapping of digit to letters (just l....

Python 刷Leetcode题库,顺带学英语单词(4)
文章 2023-05-21 来自:开发者社区

Python 刷Leetcode题库,顺带学英语单词(3)

Palindrome NumberDetermine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. [#9]    Example 1:    Input: 121    ...

Python 刷Leetcode题库,顺带学英语单词(3)
文章 2023-05-21 来自:开发者社区

Python 刷Leetcode题库,顺带学英语单词(2)

Longest Substring Without Repeating CharactersGiven a string, find the length of the longest substring without repeating characters. [#3]    Example 1:    Input: "abcabcbb"  ....

文章 2023-05-21 来自:开发者社区

Python 刷Leetcode题库,顺带学英语单词(1)

Two SumGiven 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 use the....

文章 2023-04-21 来自:开发者社区

关于 awesome-algorithm 仓库中 Python Leetcode 代码删除一事

经过我们几天的调查,结论如下:    这些代码派生于仓库 KrisYu/LeetCode-CLRS-Python,并且到目前为止,KrisYu 仍然是主要贡献者(但奇怪的是,他的名字没出现在任何一个代码中)。    我们获取了 KrisYu 的授权,但没有明确提出用于商用。    Lisanaaa 是主要维护者之一,他复制粘贴了大量代码....

文章 2023-02-09 来自:开发者社区

LeetCode 746. 使用最小花费爬楼梯 C/C++/Python——动态规划

题目描述给你一个整数数组 cost ,其中 cost[i] 是从楼梯第 i 个台阶向上爬需要支付的费用。一旦你支付此费用,即可选择向上爬一个或者两个台阶。你可以选择从下标为 0 或下标为 1 的台阶开始爬楼梯。请你计算并返回达到楼梯顶部的最低花费。示例 1:输入:cost = [10,15,20] 输出:15 解释:你将从下标为 1 的台阶开始。 - 支付 15 ,向上爬两个台阶,到达楼梯顶部。....

文章 2023-02-09 来自:开发者社区

LeetCode 70. 爬楼梯 C/C++/Python

题目描述假设你正在爬楼梯。需要 n 阶你才能到达楼顶。每次你可以爬 1 或 2 个台阶。你有多少种不同的方法可以爬到楼顶呢?示例 1:输入:n = 2 输出:2 解释:有两种方法可以爬到楼顶。 1. 1 阶 + 1 阶 2. 2 阶示例 2:输入:n = 3 输出:3 解释:有三种方法可以爬到楼顶。 1. 1 阶 + 1 阶 + 1 阶 2. 1 阶 + 2 阶 3. 2 阶 + 1 阶提示:1....

文章 2023-02-09 来自:开发者社区

LeetCode 121. 买卖股票的最佳时机 C/C++/Python

难度简单2477收藏分享切换为英文接收动态反馈给定一个数组 prices ,它的第 i 个元素 prices[i] 表示一支给定股票第 i 天的价格。你只能选择 某一天 买入这只股票,并选择在 未来的某一个不同的日子 卖出该股票。设计一个算法来计算你所能获取的最大利润。返回你可以从这笔交易中获取的最大利润。如果你不能获取任何利润,返回 0 。示例 1:输入:[7,1,5,3,6,4] 输出:5 ....

文章 2023-02-08 来自:开发者社区

LeetCode 1137. 第 N 个泰波那契数 C/C++/Python

题目描述泰波那契序列 Tn 定义如下:T0 = 0, T1 = 1, T2 = 1, 且在 n >= 0 的条件下 Tn+3 = Tn + Tn+1 + Tn+2给你整数 n,请返回第 n 个泰波那契数 Tn 的值。示例 1:输入:n = 4 输出:4 解释: T_3 = 0 + 1 + 1 = 2 T_4 = 1 + 1 + 2 = 4示例 2:输入:n = 25 输出:1389537提....

本页面内关键词为智能算法引擎基于机器学习所生成,如有任何问题,可在页面下方点击"联系我们"与我们沟通。

算法编程

开发者社区在线编程频道官方技术圈。包含算法资源更新,周赛动态,每日一题互动。

+关注