Blogs Hub

by Sumit Chourasia | Jan 18, 2021 | Category :coding

Number Of Rectangles That Can Form The Largest Square - Array - Easy - LeetCode

Number Of Rectangles That Can Form The Largest Square - Array - Easy - LeetCode

You are given an array rectangles where rectangles[i] = [li, wi] represents the ith rectangle of length li and width wi. You can cut the ith rectangle to form a square with a side length of k if both k <= li and k <= wi. For example, if you have a rectangle [4,6], you can cut it to g

read more...

by Sumit Chourasia | Jan 10, 2021 | Category :coding

Decode XORed Array - Array - Easy - LeetCode

Decode XORed Array - Array - Easy - LeetCode

There is a hidden integer array arr that consists of n non-negative integers. It was encoded into another integer array encoded of length n - 1, such that encoded[i] = arr[i] XOR arr[i + 1]. For example, if arr = [1,0,2,1], then encoded = [1,2,3]. You are given the encoded array. Yo

read more...

by Sumit Chourasia | Jan 10, 2021 | Category :coding

Calculate Money in Leetcode Bank - Maths - Easy - LeetCode

Calculate Money in Leetcode Bank - Maths - Easy - LeetCode

Hercy wants to save money for his first car. He puts money in the Leetcode bank every day. He starts by putting in $1 on Monday, the first day. Every day from Tuesday to Sunday, he will put in $1 more than the day before. On every subsequent Monday, he will put in $1 more than the previous

read more...

by Sumit Chourasia | Jan 09, 2021 | Category :coding

Task Scheduler - Array - Medium - LeetCode

Task Scheduler - Array - Medium - LeetCode

Given a characters array tasks, representing the tasks a CPU needs to do, where each letter represents a different task. Tasks could be done in any order. Each task is done in one unit of time. For each unit of time, the CPU could complete either one task or just be idle. However, there is

read more...

by Sumit Chourasia | Jan 08, 2021 | Category :coding

Maximum Units on a Truck - Array - Easy - LeetCode

Maximum Units on a Truck - Array - Easy - LeetCode

You are assigned to put some amount of boxes onto one truck. You are given a 2D array boxTypes, where boxTypes[i] = [numberOfBoxesi, numberOfUnitsPerBoxi]: numberOfBoxesi is the number of boxes of type i.<br />numberOfUnitsPerBoxi is the number of units in each box of the type i.<br />You

read more...

by Sumit Chourasia | Jan 08, 2021 | Category :coding

Determine if String Halves Are Alike - String - Easy - LeetCode

Determine if String Halves Are Alike - String - Easy - LeetCode

You are given a string s of even length. Split this string into two halves of equal lengths, and let a be the first half and b be the second half. Two strings are alike if they have the same number of vowels ('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'). Notice that s contains upperca

read more...

by Sumit Chourasia | Jan 06, 2021 | Category :coding

Number of Students Unable to Eat Lunch - String - Easy - LeetCode

Number of Students Unable to Eat Lunch - String - Easy - LeetCode

The school cafeteria offers circular and square sandwiches at lunch break, referred to by numbers 0 and 1 respectively. All students stand in a queue. Each student either prefers square or circular sandwiches. The number of sandwiches in the cafeteria is equal to the number of students. Th

read more...

by Sumit Chourasia | Jan 05, 2021 | Category :coding

Reformat Phone Number - String - Easy - LeetCode

Reformat Phone Number - String - Easy - LeetCode

You are given a phone number as a string number. number consists of digits, spaces ' ', and/or dashes '-'. You would like to reformat the phone number in a certain manner. Firstly, remove all spaces and dashes. Then, group the digits from left to right into blocks of length 3 until there a

read more...

by Sumit Chourasia | Dec 28, 2020 | Category :coding

Count of Matches in Tournament - String - Easy - LeetCode

Count of Matches in Tournament - String - Easy - LeetCode

You are given an integer n, the number of teams in a tournament that has strange rules: If the current number of teams is even, each team gets paired with another team. A total of n / 2 matches are played, and n / 2 teams advance to the next round.<br />If the current number of teams is od

read more...

by Sumit Chourasia | Dec 28, 2020 | Category :coding

Count the Number of Consistent Strings - String - Easy - LeetCode

Count the Number of Consistent Strings - String - Easy - LeetCode

You are given a string allowed consisting of distinct characters and an array of strings words. A string is consistent if all characters in the string appear in the string allowed. Return the number of consistent strings in the array words. &nbsp; Example 1: Input: all

read more...

by Sumit Chourasia | Dec 07, 2020 | Category :coding

Goal Parser Interpretation - String - Easy - LeetCode

Goal Parser Interpretation - String - Easy - LeetCode

You own a Goal Parser that can interpret a string command. The command consists of an alphabet of "G", "()" and/or "(al)" in some order. The Goal Parser will interpret "G" as the string "G", "()" as the string "o", and "(al)" as the string "al". The interpreted strings are then concatenated in th

read more...

by Sumit Chourasia | Dec 02, 2020 | Category :coding

Richest Customer Wealth - String - Easy - LeetCode

Richest Customer Wealth - String - Easy - LeetCode

You are given an m x n integer grid accounts where accounts[i][j] is the amount of money the i​​​​​​​​​​​th​​​​ customer has in the j​​​​​​​​​​​th​​​​ bank. Return the wealth that the richest customer has. A customer's wealth is the amount of money they have in all their bank accounts. The

read more...