Text Justification LeetCode Solution

We will discuss Text Justification LeetCode Solution today Problem Statement The problem “Text Justification” states that you are given a list s[ ] of type string of size n and an integer size. Justify the text such that each line of text consists of size number of characters. You can …

Read more

Replace two consecutive equal values with one greater

Problem Statement Suppose you have an integer array. The problem “Replace two consecutive equal values with one greater” asks to replace all those pair values say ‘a’ which comes consecutively with a number “a+1” 1 greater than them (two consecutive numbers), such that even after the modification or repetition there …

Read more

Count subarrays having total distinct elements same as original array

Problem Statement “Count subarrays having total distinct elements same as original array” states that you are given an integer array. The problem statement asks to find out the total number of sub-arrays that contain all distinct elements as present in an original array. Example arr[] = {2, 1, 3, 2, …

Read more

Merge Overlapping Intervals

In merge overlapping intervals problem we have given a collection of intervals, merge and return all overlapping intervals. Example Input : [[2, 3], [3, 4], [5, 7]] Output: [[2, 4], [5, 7]] Explanation: We can merge [2, 3] and [3, 4] together to form [2, 4] Approach for finding Merge …

Read more

Decode Ways

In Decode Ways problem we have given a non-empty string containing only digits, determine the total number of ways to decode it using the following mapping: ‘A’ -> 1 ‘B’ -> 2 … ‘Z’ -> 26 Example S = “123” Number of ways to decode this string is 3 If we …

Read more

Translate »