leetcode.com 2023-08-04
🟡139.word-break
🏷️ Tags
#trie #memoization #array #hash_table #string #dynamic_programming
🟡139.word-break
🏷️ Tags
#trie #memoization #array #hash_table #string #dynamic_programming
Telegraph
word-break
Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words. Note that the same word in the dictionary may be reused multiple times in the segmentation. Example…
leetcode.com 2023-08-05
🟡95.unique-binary-search-trees-ii
🏷️ Tags
#tree #binary_search_tree #dynamic_programming #backtracking #binary_tree
🟡95.unique-binary-search-trees-ii
🏷️ Tags
#tree #binary_search_tree #dynamic_programming #backtracking #binary_tree
Telegraph
unique-binary-search-trees-ii
Given an integer n, return all the structurally unique BST's (binary search trees), which has exactly n nodes of unique values from 1 to n. Return the answer in any order. Example 1: Input: n = 3 Output: [[1,null,2,null,3],[1,null,3,2],[2,1,3],[3,1,null…
leetcode.com 2023-08-06
🔴920.number-of-music-playlists
🏷️ Tags
#math #dynamic_programming #combinatorics
🔴920.number-of-music-playlists
🏷️ Tags
#math #dynamic_programming #combinatorics
Telegraph
number-of-music-playlists
Your music player contains n different songs. You want to listen to goal songs (not necessarily different) during your trip. To avoid boredom, you will create a playlist so that:
leetcode.com 2023-08-09
🟡2616.minimize-the-maximum-difference-of-pairs
🏷️ Tags
#greedy #array #binary_search
🟡2616.minimize-the-maximum-difference-of-pairs
🏷️ Tags
#greedy #array #binary_search
Telegraph
minimize-the-maximum-difference-of-pairs
You are given a 0-indexed integer array nums and an integer p. Find p pairs of indices of nums such that the maximum difference amongst all the pairs is minimized. Also, ensure no index appears more than once amongst the p pairs. Note that for a pair of elements…
leetcode.cn 2023-08-12
🔴23.merge-k-sorted-lists
🏷️ Tags
#linked_list #divide_and_conquer #heap_priority_queue #merge_sort
🔴23.merge-k-sorted-lists
🏷️ Tags
#linked_list #divide_and_conquer #heap_priority_queue #merge_sort
Telegraph
merge-k-sorted-lists
给你一个链表数组,每个链表都已经按升序排列。 请你将所有链表合并到一个升序链表中,返回合并后的链表。 示例 1: 输入:lists = [[1,4,5],[1,3,4],[2,6]] 输出:[1,1,2,3,4,4,5,6] 解释:链表数组如下: [ 1->4->5, 1->3->4, 2->6 ] 将它们合并到一个有序链表中得到。 1->1->2->3->4->4->5->6 示例 2: 输入:lists = [] 输出:[] 示例 3: 输入:lists = [[]] 输出:[] 提示:
leetcode.com 2023-08-13
🟡2369.check-if-there-is-a-valid-partition-for-the-array
🏷️ Tags
#array #dynamic_programming
🟡2369.check-if-there-is-a-valid-partition-for-the-array
🏷️ Tags
#array #dynamic_programming
Telegraph
check-if-there-is-a-valid-partition-for-the-array
You are given a 0-indexed integer array nums. You have to partition the array into one or more contiguous subarrays. We call a partition of the array valid if each of the obtained subarrays satisfies one of the following conditions: