Home
Gaurav's GitHub Page
Cancel

Transpose of a Matrix

PROBLEM DESCRIPTION Write a program to find the transpose of a square matrix of size N*N. Transpose of a matrix is obtained by changing rows to columns and columns to rows. geeksforgeeks SOLUTIO...

Even Subarrays

PROBLEM DESCRIPTION You are given an integer array A. Decide whether it is possible to divide the array into one or more subarrays of even length such that the first and last element of all subarr...

Closest MinMax

PROBLEM DESCRIPTION Given an array A of size N. The task is to find the length of smallest subarray which contains both maximum and minimum values. geeksforgeeks SOLUTION APPROACH 1 First we g...

Pick from both sides!

PROBLEM DESCRIPTION Given an integer array A of size N. You have to pick exactly B elements from either left or right end of the array A to get the maximum sum. Find and return this maximum possib...

Balance Array (Special Index)

PROBLEM DESCRIPTION Given an integer array A of size N. You need to count the number of special elements in the given array. A element is special if removal of that element make the array balanced...

Serialize and Deserialize Binary Tree

PROBLEM DESCRIPTION Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a netwo...

Sliding Window Maximum

Problem Description You are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers i...

Minimum Window Substring

Problem Description Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every character in t (including duplicates) is included in the win...

LRU Cache

Problem Description Design a data structure that follows the constraints of a Least Recently Used (LRU) cache. Implement the LRUCache class: LRUCache(int capacity) Initialize the LRU cache wi...

Alien Dictionary

Problem Description There is a new alien language that uses the English alphabet. However, the order among the letters is unknown to you. You are given a list of strings words from the alien lang...