Split Array into Consecutive Subsequences
Split an array into consecutive subsequences.
Input: nums = [1,2,3,4,4,5]
Output: FALSE
Explanation: The numbers can form [1,2,3,4], but the remaining leftover group [4,5] is too short to form a valid sequence of length 3.
Top K Frequent Elements
Find the top K frequent elements in an array.
Input: nums = [4,4,4,4,5,5,6], k = 1
Output: [4]
Explanation: The number 4 appears four times, easily making it the single most frequent element in the data structure.
Dot Product of Two Sparse Vectors
Calculate the dot product of two sparse vectors.
Input: nums1 = [0,1,0,0,2], nums2 = [0,0,0,0,5]
Output: 10
Explanation: Multiplies the aligned non-zero values (2 * 5) and ignores all the zeros, yielding a dot product of 10.
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…
Take a look at this regression dashboard. Translate the log odds for a sales manager, point out where the analysis falls short, and suggest a more robust methodological approach.