Clone an Undirected Graph
Clone an undirected graph.
Input: adjList = [[]]
Output: [[]]
Explanation: Creates a new, deeply cloned graph containing only one single node with zero connected neighbors.
Aggressive Cows
Maximize the minimum distance between aggressive cows in stalls.
Input: stalls = [0,4,3,7,10,9], cows = 3
Output: 4
Explanation: Placing the cows at positions 0, 4, and 10 yields a maximum possible minimum distance of 4 between any two cows.
Palindrome After Deleting One Character
Determine if a string can be a palindrome after deleting at most one character.
Input: s = "abc"
Output: FALSE
Explanation: Deleting any single character leaves either "ab", "bc", or "ac", none of which result in a valid palindrome.
Perform a depth-first search on a matrix to find connected components.
Given an n x n matrix where isConnected[i][j] = 1 if the ith node and the jth node are directly connected, and 0 otherwise, return the total number of connected components.
Input: isConnected = [[1,0,0],[0,1,0],[0,0,1]]
Output: 3
Explanation: There are no connectio…
Minimum Window Substring
Find the minimum window substring that contains all characters of another string.
Input: s = "a", t = "aa"
Output: "" (Empty String)
Explanation: The target requires two 'a's, but the source string only contains one, making it impossible to form a valid window.
Implement String Compression
Implement string compression.
Input: chars = ["a","b","b","b","b","b","b","b","b","b","b","b","b"]
Output: ["a","b","1","2"]
Explanation: The letter 'a' appears once (so no number is appended), and 'b' appears 12 times, modifying the array in place to length 4.
Connected Components in an Undirected Graph
Determine the number of connected components in an undirected graph.
Input: n = 4, edges = [[0,1],[2,3]]
Output: 2
Explanation: The graph is split completely evenly into two distinct isolated components: nodes {0,1} and nodes {2,3}.