Problem: There are n people whose IDs go from 0 to n - 1 and each person belongs exactly to one group. Given the array groupSizes of length n telling the group size each person belongs to, return the groups there are and the people’s IDs each group includes. You can return any solution in any order and the same applies for IDs. Also, it is guaranteed that there exists at least one solution. Example: Input: groupSizes = [3,3,3,3,3,1,3] Output: [[5],[0,1,2],[3,4,6]] Explanation: Other …

#### Blog Posts

Problem: Given an array of integers nums and an integer threshold, we will choose a positive integer divisor and divide all the array by it and sum the result of the division. Find the smallest divisor such that the result mentioned above is less than or equal to threshold. Each result of division is rounded to the nearest integer greater than or equal to that element. (For example: 7/3 = 3 and 10/2 = 5). It is guaranteed that there will be an answer. Example: Input: nums …

Problem: An integer has sequential digits if and only if each digit in the number is one more than the previous digit. Return a sorted list of all the integers in the range [low, high] inclusive that have sequential digits. Example: Input: low = 100, high = 300 Output: [123,234] Constraints: 10 <= low <= high <= 10^9 Solution: class Solution: def sequentialDigits(low, high): result = [] start = int(str(low)[0]) for val in range(1, len(str(low))): new_val = start%10 + 1 start = start*10 …

Problem: Given an array nums of integers, return how many of them contain an even number of digits. Example: Input: nums = [12,345,2,6,7896] Output: 2 Explanation: 12 contains 2 digits (even number of digits). 345 contains 3 digits (odd number of digits). 2 contains 1 digit (odd number of digits). 6 contains 1 digit (odd number of digits). 7896 contains 4 digits (even number of digits). Therefore only 12 and 7896 contain an even number of digits. Constraints: 1 <= …

Problem: Given an array of integers nums and a positive integer k, find whether it’s possible to divide this array into sets of k consecutive numbers. Return True if its possible otherwise return False. Example: Input: nums = [1,2,3,3,4,4,5,6], k = 4 Output: true Explanation: Array can be divided into [1,2,3,4] and [3,4,5,6]. Constraints: 1 <= nums.length <= 10^5 1 <= nums[i] <= 10^9 1 <= k <= nums.length Solution: class Solution: def isPossibleDivide(nums, k): from collections import Counter count_map = Counter(nums) for num in sorted(count_map.keys()): if count_map[num] <= …

Summer is coming to an end and the university students have already started planning for the return to the classroom. No matter how excited we get to see and spend time with our friends again, the studying part of school can still be daunting. However, the perk of being in 21st century is that technology can make everyone’s life a lot easier. And, it is not at all necessary that students need to spend hundreds of bucks on tech gadgets …

Now that we have all celebrated our love and respect towards our incredible moms, it is time to acknowledge the Man in our lives. It is time to let our dads know that they nonetheless than our moms. They are the knights who saved us from boogeyman when we were kids; they are the friends who taught us many essential things from fishing, cycling to tough lessons of life. Like moms, dads do not deserve only one day of celebration; …

Businesses like restaurants, food chains, bakeries and more are developing on the strength of their food photography. A perfect picture that captures the essence of a dish can help tremendously in the social media marketing strategy, blog post, or product photo. Taking great photographs of food is a hard-earned skill. But these days learning new artistry or abilities are also a lot easier thanks to the internet, no matter who you are; even a smartphone can yield gorgeous, high-quality images. …