• 【力扣】55. 跳跃游戏 - 力扣(LeetCode)-复杂度

    时间:2024-04-19 14:24:02

    时间复杂度: o ( n ...

  • LeetCode -- Triangle 路径求最小和( 动态规划问题)

    时间:2024-04-18 18:08:06

    Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the fol...

  • LeetCode 笔记24 Palindrome Partitioning II (智商碾压)

    时间:2024-04-18 16:36:01

    Given a string s, partition s such that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning ...

  • leetcode747-Largest Number At Least Twice of Others-题目

    时间:2024-04-18 08:23:45

    给你一个整数数组 nums ,其中总是存在 唯一的 一个最大整数 。 请你找出数组中的最大元素并检查它是否 至少是数组中每个其他数字的两倍 。如果是,则返回 最大元素的下标 ,否则返回 -1 。 示例 1: 输入:nums = [3,6,1,0] 输出:1 解释:6 是最大的整数,对于数组中的其他

  • 稀碎从零算法笔记Day46-LeetCode:互质树

    时间:2024-04-17 07:01:13

    这几天有点懈怠了 题型:树、DFS、BSF、数学 链接:1766. 互质树 - 力扣(LeetCode) 来源:LeetCode 题目描述 给你一个 n 个节点的树(也就是一个无环连通无向图),节点编号从 0 到 n - 1 ,且恰好有 n - 1 条边,每个节点有一个值。树的 根节点 为 0 号点...

  • leetcode 32. Longest Valid Parentheses

    时间:2024-04-16 23:35:49

    Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the lon...

  • leetcode51 N皇后问题

    时间:2024-04-16 13:21:00

    class Solution {public: // vector<string> path_; vector<vector<string>> res_; bool valid(vector<string>& chessboa...

  • 【一天一道LeetCode】#20. Valid Parentheses

    时间:2024-04-16 13:08:14

    一天一道LeetCode系列(一)题目Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.The brackets ...

  • leetcode022. Generate Parentheses

    时间:2024-04-15 20:52:06

    leetcode 022. Generate ParenthesesConcise recursive C++ solutionclass Solution {public: vector<string> generateParenthesis(int n) { ve...

  • [LeetCode] Masking Personal Information 给个人信息打码

    时间:2024-04-15 13:15:45

    We are given a personal information string S, which may represent either an email address or a phone number.We would like to mask this personal inform...

  • C语言双指针,leetcode: 盛最多水的容器

    时间:2024-04-15 10:56:21

    给定一个长度为 n 的整数数组 height 。有 n 条垂线,第 i 条线的两个端点是 (i, 0) 和 (i, height[i]) 。 找出其中的两条线,使得它们与 x 轴共同构成的容器可以容纳最多的水。 返回容器可以储存的最大水量。 说明:你不能倾斜容器。 示例 1: 输入:[1,8,6...

  • 贪心 Leetcode 406 根据身高重建队列

    时间:2024-04-15 08:12:11

    根据身高重建队列 假设有打乱顺序的一群人站成一个队列,数组 people 表示队列中一些人的属性(不一定按顺序)。每个 people[i] = [hi, ki] 表示第 i 个人的身高为 hi ,前面 正好 有 ki 个身高大于或等于 hi 的人。 请你重新构造并返回输入数组 people 所表示的...

  • 【LeetCode的使用方法】讲解

    时间:2024-04-15 07:33:22

    LeetCode的使用方法 LeetCode 是一个在线编程平台,广泛用于技术面试的准备和编程技能的提高。以下是基本的 LeetCode 使用方法: 注册账户: 访问 LeetCode 官网。点击右上角的 “Sign up”,填写必要的信息完成注册。 登录平台: 如果你已有账户,点击 “S...

  • LeetCode-705. 设计哈希集合【设计 数组 哈希表 链表 哈希函数】-题目描述:

    时间:2024-04-15 07:10:40

    不使用任何内建的哈希表库设计一个哈希集合(HashSet)。 实现 MyHashSet 类: void add(key) 向哈希集合中插入值 key 。 bool contains(key) 返回哈希集合中是否存在这个值 key 。 void remove(key) 将给定值 key 从哈希集合中...

  • LeetCode题练习与总结:加一--66-输入:digits = [0] 输出:[1] 提示:

    时间:2024-04-15 06:56:16

    1 <= digits.length <= 1000 <= digits[i] <= 9二、解题思路 首先,我们需要遍历数组的每一位数字,从最低位(数组的最后一个元素)开始。对于每一位数字,我们将其加一。如果加一后的结果小于10,那么直接更新该位的数字,并且结束循环,因为我...

  • ​LeetCode解法汇总1702. 修改后的最大二进制字符串

    时间:2024-04-14 22:31:55

    目录链接: 力扣编程题-解法汇总_分享+记录-CSDN博客 GitHub同步刷题项目: https://github.com/September26/java-algorithms 原题链接:. - 力扣(LeetCode) 描述: 给你一个二进制字符串 binary ,它仅有 0 或者 1 ...

  • LeetCode 343. 整数拆分-输入: n = 10 输出: 36 解释: 10 = 3 + 3 + 4, 3 × 3 × 4 = 36。 提示:

    时间:2024-04-14 13:20:47

    2 <= n <= 58 思路: 本题采用动态规划解决。dp[ i ] 表示 整数 i 拆解后的最大乘积。 确定递推公式:dp[ i ] 有两个来源,一是 j * (i - j),二是 j * dp[ i- j ],前者表示将 整数 i 拆成两个正整数进行乘积,后者表示将整数 i 拆成...

  • 厉害了!LeetCode 解题笔记终于在GitHub开源了!

    时间:2024-04-14 08:42:56

    点击“开发者技术前线”,选择“星标????”在看|星标|留言,  真爱今天给大家分享2套手册。先看看一大牛整理了一套初学到进阶的 LeetCode学习资料,分享一个火爆 GitHub 的 LeetCode 刷题项目(Fucking Algorithm)最近终于出电子版了!喜欢面试大厂无压力。先来给你...

  • leetcode142 环形链表2

    时间:2024-04-14 07:15:58

    题目 给定一个链表的头节点  head ,返回链表开始入环的第一个节点。 如果链表无环,则返回 null。 如果链表中有某个节点,可以通过连续跟踪 next 指针再次到达,则链表中存在环。 为了表示给定链表中的环,评测系统内部使用整数 pos 来表示链表尾连接到链表中的位置(索引从 0 开始)。如果...

  • LeetCode刷题日志 486. 预测赢家

    时间:2024-04-13 19:05:13

    学习目标:给定一个表示分数的非负整数数组。 玩家 1 从数组任意一端拿取一个分数,随后玩家 2 继续从剩余数组任意一端拿取分数,然后玩家 1 拿,…… 。每次一个玩家只能拿取一个分数,分数被拿取之后不再可取。直到没有剩余分数可取时游戏结束。最终获得分数总和最多的玩家获胜。给定一个表示分数的数组,预测...