Satvik Watts has Published 10 Articles

Three-way partitioning of an Array without changing the relative ordering

Satvik Watts

Satvik Watts

Updated on 01-Nov-2023 12:55:18

79 Views

In this article, we will do a three-way partitioning of an array containing N integers. The approach is to use three queues. Each of these queues will be used to store the elements of one of the parts. After that, we can get the elements of each part from their ... Read More

Sum of Array maximums after K operations by reducing max element to its half

Satvik Watts

Satvik Watts

Updated on 01-Nov-2023 12:53:00

65 Views

In this article, we will calculate the sum of the array maximums after K operations in which we reduce the maximum value of the array to its half. In the first approach, we will implement the brute force solution to this problem. In each iteration, we will use a for ... Read More

Sort a given array which is already sorted based on the absolute value of the element

Satvik Watts

Satvik Watts

Updated on 01-Nov-2023 12:51:02

75 Views

In this article, we will sort the given array. The given array is already sorted on the basis of absolute value of the elements, we just need to sort the array based on the true values of the elements. In the first approach, we will use a sorting algorithm, like ... Read More

Shortest path between two points in a Matrix with at most K obstacles

Satvik Watts

Satvik Watts

Updated on 01-Nov-2023 12:49:25

84 Views

In this article, we will find the shortest path between two points in a matrix. The matrix contains two types of cells, empty cells and cells which have obstacles. We are given an integer K, which represents that we can remove at most K obstacles to reach our destination. In ... Read More

C++ Program to Find Minimum circular rotations to obtain a given numeric string by avoiding a set of strings

Satvik Watts

Satvik Watts

Updated on 01-Nov-2023 12:44:40

23 Views

In this article, we will find the minimum circular rotations that are needed to obtain a given numeric string, target, by avoiding a given set of strings. The target strings and the strings in the set of string both have a size of N. The initial string will be a ... Read More

Maximum count of pairs such that element at position i is included in a[i] pairs

Satvik Watts

Satvik Watts

Updated on 01-Nov-2023 12:40:29

28 Views

In this article, we will find the number of the pair of indices, such that an index i can be included in at most a[i] number of pairs. In the approach discussed in this article, we will use a priority queue data structure which will contain the elements of ... Read More

Maximum width of a Binary Tree with null values

Satvik Watts

Satvik Watts

Updated on 01-Nov-2023 12:34:52

81 Views

A binary tree is defined as a tree data structure where each has at most two children. The width of a binary tree for a level is defined as the number of nodes between the rightmost and leftmost nodes of that level, including the NULL nodes that come in between. ... Read More

Longest subsegment of 1’s formed by changing at most k 0’s (Using Queue)

Satvik Watts

Satvik Watts

Updated on 01-Nov-2023 12:30:09

48 Views

In this article, we will find the longest subsegment of 1’s which can be formed by changing at most k 0’s to 1’s. We will be using queue data structure to solve this problem. In the approach discussed in this article, we will use a queue data structure to find ... Read More

FIFO Push Relabel Algorithm

Satvik Watts

Satvik Watts

Updated on 01-Nov-2023 12:15:11

86 Views

The FIFO Push Relabel algorithm is an algorithm that is used to solve the maximum flow problem. The maximum flow problem is a problem in graph theory in which we have to find the maximum amount of flow of resources or information that can be sent via an interconnected network ... Read More

Count of pair of nodes at even distance (Using BFS)

Satvik Watts

Satvik Watts

Updated on 01-Nov-2023 11:56:06

33 Views

In this article, we will find the number of the pair of nodes, which are at an even distance of each other in a graph. We will be using the breadth first search (BFS) approach to find the total count. In the approach discussed in this article, we will use ... Read More

1
Advertisements