3058 Maximum Number Of K Divisible Components
Maximum Number of K-Divisible Components There is an undirected tree with n nodes labeled from 0 to n - 1. You are given the integer n and a 2D integer array edges of length n - 1, where edges[i]...
Maximum Number of K-Divisible Components There is an undirected tree with n nodes labeled from 0 to n - 1. You are given the integer n and a 2D integer array edges of length n - 1, where edges[i]...
Greatest Sum Divisible by Three Given an integer array nums, return the **maximum possible sum **of elements of the array such that it is divisible by three. Example 1: **Input:** nums = [3...
Find Minimum Operations to Make All Elements Divisible by Three You are given an integer array nums. In one operation, you can add or subtract 1 from any element of nums. Return the minimum numb...
Set Intersection Size At Least Two You are given a 2D integer array intervals where intervals[i] = [starti, endi] represents all the integers from starti to endi inclusively. A containing set is...
Keep Multiplying Found Values by Two You are given an array of integers nums. You are also given an integer original which is the first number that needs to be searched for in nums. You then do ...
1-bit and 2-bit Characters We have two special characters: The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11). Given a binary a...
Check If All 1’s Are at Least Length K Places Away Given an binary array nums and an integer k, return true* if all 1’s are at least k places away from each other, otherwise return *false. Ex...
Number of Substrings With Only 1s Given a binary string s, return the number of substrings with all characters 1’s. Since the answer may be too large, return it modulo 109 + 7. Example 1: *...
Count the Number of Substrings With Dominant Ones You are given a binary string s. Return the number of substrings with dominant ones. A string has dominant ones if the number of ones in the st...
Increment Submatrices by One You are given a positive integer n, indicating that we initially have an n x n 0-indexed integer matrix mat filled with zeroes. You are also given a 2D integer array...