Can Place Flowers Problem

Problem You have a long flowerbed in which some of the plots are planted, and some are not. However, flowers cannot be planted in adjacent plots. Given an integer array flowerbed containing 0’s and 1’s, where 0 means empty and 1 means not empty, and an integer n, return if n new flowers can be planted in the flowerbed without violating the no-adjacent-flowers rule. Examples Example 1: ...

Integer to English Words Problem

Problem Convert a non-negative integer num to its English words representation. Examples Example 1: Input: num = 123 Output: "One Hundred Twenty Three" Example 2: Input: num = 12345 Output: "Twelve Thousand Three Hundred Forty Five" Example 3: ...

Next Greater Element 3 - Find smallest number larger than given number using same digits

Problem Given a positive integer n, find the smallest integer which has exactly the same digits existing in the integer n and is greater in value than n. If no such positive integer exists, return -1. Note that the returned integer should fit in 32-bit integer, if there is a valid answer but it does not fit in 32-bit integer, return -1. Examples Example 1: Input: n = 12 Output: 21 ...

Largest Number From Given Numbers

Problem Given a list of non-negative integers nums, arrange them such that they form the largest number and return it. Since the result may be very large, so you need to return a string instead of an integer. Example Example 1: Input: nums = [10,2] Output: "210" Example 2: Input: nums = [3,30,34,5,9] Output: "9534330" ...

Course Schedule 3 Problem

Problem There are n different online courses numbered from 1 to n. You are given an array courses where courses[i] = [durationi, lastDayi] indicate that the ith course should be taken continuously for durationi days and must be finished before or on lastDayi. You will start on the 1st day and you cannot take two or more courses simultaneously. Return the maximum number of courses that you can take. ...

Coin Change with Fewest Number of Coins Given Canonical System and Infinite Supply

Problem Given a amount ‘A’ and n coins/denominations v1<v2<v3<………..<vn . Write a program to find out minimum numbers of coins required to make the change for the amount ‘A’. It is also given the coin system is canonical. OR Find the minimum number of coins needed to change the input value (an integer) into coins with denominations 1, 5, and 10. Examples Example 1: ...

Remove Covered Intervals Problem

Problem Given an array intervals where intervals[i] = [li, ri] represent the interval [li, ri), remove all intervals that are covered by another interval in the list. The interval [a, b) is covered by the interval [c, d) if and only if c <= a and b <= d. Return the number of remaining intervals. Examples Example 1: Input: intervals = [ [1,4],[3,6],[2,8] ] Output: 2 Explanation: Interval [3,6] is covered by [2,8], therefore it is removed. ...

Maximum Intervals Overlap Count

Problem Find maximum intervals overlap. OR There is number of elephants time span given, here time span means, year of birth to year of death. You have to calculate the period where maximum number of elephants are alive. OR Consider a big party where a log register for guest’s entry and exit times is maintained. Find the time at which there are maximum guests in the party. Note that entries in register are not in any order. ...

This site uses cookies to improve your experience on our website. By using and continuing to navigate this website, you accept this. Privacy Policy