# Category Archives: Data Structures

Given two strings s1 and s2, The task is to convert s1 into a palindrome such that s1 contains s2 as a substring in a… Read More
Given an array nums of length N which contains two types of numbers, one which has the value zero, the second which is a positive… Read More
Given a binary matrix mat[][] of size m*n (0-based indexing), find the number of 1’s such that 1 is located at a specific position where… Read More
Given an array arr[], the task is to check if the array can be sorted using the given operation any number of times. In one… Read More
A hash table is a data structure that allows for quick insertion, deletion, and retrieval of data. It works by using a hash function to… Read More
Given an array arr[] of length N of 0’s and 1’s, the task is to find the total number of subarrays of 0’s. Examples: Input:… Read More
Given an array dir_list[] that represents direction where the valid directions are “UP”, “Left”, “Right” and “Down”. Your goal is to reduce the instructions by… Read More
Two players X and Y are playing a game in which there are pots of gold arranged in a line, each containing some gold coins.… Read More
There is a string of size N containing only ‘A’ and ‘O’. ‘A’ stands for Apple, and ‘O’ stands for Orange. We have M number… Read More
Outdegree of a vertex is defined as the number of outgoing edges from a vertex in a directed graph. Significance of Outdegree: The outdegree of… Read More
A stack is defined as a linear data structure that is open at one end and the operations follow the Last-In-First-Out (LIFO) order. Example of… Read More
The Bell triangle or Aitken’s array or the Pierce Triangle is the number triangle obtained by beginning the first row with the number one, then… Read More
A Queue is defined as a linear data structure that is open at both ends and the operations are performed in the First In First… Read More
Given a singly linked list List containing N nodes representing a number, the task is to check whether the given linked list is an Armstrong… Read More
Given an integer N which corresponds to a N x N grid. The score you can get from a cell at the ith row and… Read More