leetcode.com 2023-12-27
🟡1578.minimum-time-to-make-rope-colorful
🏷️ Tags
#greedy #array #string #dynamic_programming
🟡1578.minimum-time-to-make-rope-colorful
🏷️ Tags
#greedy #array #string #dynamic_programming
Telegraph
minimum-time-to-make-rope-colorful
Alice has n balloons arranged on a rope. You are given a 0-indexed string colors where colors[i] is the color of the ith balloon. Alice wants the rope to be colorful. She does not want two consecutive balloons to be of the same color, so she asks Bob for…
leetcode.com 2023-12-30
🟢1897.redistribute-characters-to-make-all-strings-equal
🏷️ Tags
#hash_table #string #counting
🟢1897.redistribute-characters-to-make-all-strings-equal
🏷️ Tags
#hash_table #string #counting
Telegraph
redistribute-characters-to-make-all-strings-equal
You are given an array of strings words (0-indexed). In one operation, pick two distinct indices i and j, where words[i] is a non-empty string, and move any character from words[i] to any position in words[j]. Return true if you can make every string in words…
leetcode.com 2023-12-31
🟢1624.largest-substring-between-two-equal-characters
🏷️ Tags
#hash_table #string
🟢1624.largest-substring-between-two-equal-characters
🏷️ Tags
#hash_table #string
Telegraph
largest-substring-between-two-equal-characters
Given a string s, return the length of the longest substring between two equal characters, excluding the two characters. If there is no such substring return -1. A substring is a contiguous sequence of characters within a string. Example 1: Input: s = "aa"…
leetcode.com 2024-01-02
🟡2610.convert-an-array-into-a-2d-array-with-conditions
🏷️ Tags
#array #hash_table
🟡2610.convert-an-array-into-a-2d-array-with-conditions
🏷️ Tags
#array #hash_table
Telegraph
convert-an-array-into-a-2d-array-with-conditions
You are given an integer array nums. You need to create a 2D array from nums satisfying the following conditions:
leetcode.cn 2024-01-03
🟡2487.remove-nodes-from-linked-list
🏷️ Tags
#stack #recursion #linked_list #monotonic_stack
🟡2487.remove-nodes-from-linked-list
🏷️ Tags
#stack #recursion #linked_list #monotonic_stack
Telegraph
remove-nodes-from-linked-list
给你一个链表的头节点 head 。 移除每个右侧有一个更大数值的节点。 返回修改后链表的头节点 head 。 示例 1: 输入:head = [5,2,13,3,8] 输出:[13,8] 解释:需要移除的节点是 5 ,2 和 3 。 - 节点 13 在节点 5 右侧。 - 节点 13 在节点 2 右侧。 - 节点 8 在节点 3 右侧。 示例 2: 输入:head = [1,1,1,1] 输出:[1,1,1,1] 解释:每个节点的值都是 1 ,所以没有需要移除的节点。 提示:
leetcode.cn 2024-01-04
🟡2397.maximum-rows-covered-by-columns
🏷️ Tags
#bit_manipulation #array #backtracking #enumeration #matrix
🟡2397.maximum-rows-covered-by-columns
🏷️ Tags
#bit_manipulation #array #backtracking #enumeration #matrix
Telegraph
maximum-rows-covered-by-columns
给你一个下标从 0 开始、大小为 m x n 的二进制矩阵 matrix ;另给你一个整数 numSelect,表示你必须从 matrix 中选择的 不同 列的数量。 如果一行中所有的 1 都被你选中的列所覆盖,则认为这一行被 覆盖 了。 形式上,假设 s = {c1, c2, ...., cnumSelect} 是你选择的列的集合。对于矩阵中的某一行 row ,如果满足下述条件,则认为这一行被集合 s 覆盖:
leetcode.com 2024-01-04
🟡2870.minimum-number-of-operations-to-make-array-empty
🏷️ Tags
#greedy #array #hash_table #counting
🟡2870.minimum-number-of-operations-to-make-array-empty
🏷️ Tags
#greedy #array #hash_table #counting
Telegraph
minimum-number-of-operations-to-make-array-empty
You are given a 0-indexed array nums consisting of positive integers. There are two types of operations that you can apply on the array any number of times:
leetcode.cn 2024-01-05
🔴1944.number-of-visible-people-in-a-queue
🏷️ Tags
#stack #array #monotonic_stack
🔴1944.number-of-visible-people-in-a-queue
🏷️ Tags
#stack #array #monotonic_stack
Telegraph
number-of-visible-people-in-a-queue
有 n 个人排成一个队列,从左到右 编号为 0 到 n - 1 。给你以一个整数数组 heights ,每个整数 互不相同,heights[i] 表示第 i 个人的高度。 一个人能 看到 他右边另一个人的条件是这两人之间的所有人都比他们两人 矮 。更正式的,第 i 个人能看到第 j 个人的条件是 i < j 且 min(heights[i], heights[j]) > max(heights[i+1], heights[i+2], ..., heights[j-1]) 。 请你返回一个长度为 n 的数…
leetcode.com 2024-01-05
🟡300.longest-increasing-subsequence
🏷️ Tags
#array #binary_search #dynamic_programming
🟡300.longest-increasing-subsequence
🏷️ Tags
#array #binary_search #dynamic_programming
Telegraph
longest-increasing-subsequence
Given an integer array nums, return the length of the longest strictly increasing subsequence. Example 1: Input: nums = [10,9,2,5,3,7,101,18] Output: 4 Explanation: The longest increasing subsequence is [2,3,7,101], therefore the length is 4. Example 2:…