Minimum number of reversals to reach node 0 from every other node
Given a Directed Graph with N vertices value from 0 to N – 1 and N – 1 Edges, the task is to count the number of edges must be reversed so that there is always a path from every node to node 0....
read more
Maximum of XOR of first and second maximum of all subarrays
Given an array arr[] of distinct elements, the task is to find the maximum of XOR value of the first and second maximum elements of every possible subarray.Note: Length of the Array is greater than 1. Examples:...
read more
Rearrange and update array elements as specified by the given queries
Given an array arr[] of size N and queries Q[][], the task is to perform the following types of queries on the given array. 0: Left shift the array by one position....
read more
unordered_map reserve() in C++ STL
As we know a Bucket is a slot in the container’s internal hash table to which all the element are assigned based on the hash value of their key...
read more
Range Sum Queries and Update with Square Root
Given an array A of N integers and number of queries Q. You have to answer two types of queries....
read more
Preorder, Postorder and Inorder Traversal of a Binary Tree using a single Stack
Given a binary tree, the task is to print all the nodes of the binary tree in Pre-order, Post-order, and In-order iteratively using only one stack traversal....
read more
Static and Dynamic Data Structures
Data structures are the fundamental building blocks of computer programming. They determine how data is organized, stored, and manipulated within a software application. There are two main categories of data structures: static and dynamic. Static data structures have a fixed size and are allocated in memory during compile-time, while dynamic data structures can grow and shrink in size during runtime. This article will provide an overview of the key differences between static and dynamic data structures, their use cases, and the trade-offs to consider when choosing between them....
read more
Google Software Engineering Intern, Fall 2019 – North America
...
read more
Check if all occurrences of a character appear together
Given a string s and a character c, find if all occurrences of c appear together in s or not. If the character c does not appear in the string at all, the answer is true....
read more
Different ways to copy a string in C/C++
Copying a string is a common operation in C/C++ used to create a duplicate copy of the original string. In this article, we will see how to copy strings in C/C++....
read more
Count the number of pop operations on stack to get each element of the array
Prerequisite: Stack, Hashing...
read more
Applications, Advantages and Disadvantages of Binary Search
Binary Search is defined as a searching algorithm used in a sorted array by repeatedly dividing the search interval in half. The idea of binary search is to use the information that the array is sorted and reduce the time complexity to O(log N). Binary search is a versatile algorithm with numerous applications in various fields....
read more