Reorganize The Array
Given an array of elements arr[] with indices ranging from 0 to arr.size() – 1, your task is to write a program that rearranges the elements […]
Given an array of elements arr[] with indices ranging from 0 to arr.size() – 1, your task is to write a program that rearranges the elements […]
A ramp in an integer array nums is a pair (i, j) for which i < j and nums[i] <= nums[j]. The width of such a ramp is j – i. Given
Given an array arr[] with repeated elements, the task is to find the maximum distance between two occurrences of an element. Note: You
A parentheses string is valid if and only if: It is the empty string, It can be written as AB (A concatenated with B),
Given a Matrix mat of n*n size. Your task is constructing a 2D linked list representation of the given matrix. Input: mat = [[1,
You are given a 0-indexed string s of even length n. The string consists of exactly n / 2 opening brackets ‘[‘ and n / 2 closing brackets ‘]’. A string is called balanced if and only
Find the largest pair sum in an array of distinct integers. Examples : Input: arr[] = [12, 34, 10, 6, 40] Output:
You are given a string s consisting only of uppercase English letters. You can apply some operations to this string where, in one operation,
An ordinary Doubly Linked List requires space for two address fields to store the addresses of previous and next nodes.
You are given two strings sentence1 and sentence2, each representing a sentence composed of words. A sentence is a list of words that are separated by a single space
Given a grid of size n*m (n is the number of rows and m is the number of columns in
Given two strings s1 and s2, return true if s2 contains a permutation of s1, or false otherwise. In other words, return true if one of s1‘s permutations is the substring of s2. Example 1: