Given an integer k and a linked list, every node of which consists of a pair of integer variable first and second to hold the… Read More »

Given a person who is at position current_pos and a binary string path which is the moves the person took, if path[i] = ‘0’ then… Read More »

Given a string str, the task is to find the count of all the sub-strings of length four whose characters can be rearranged to form… Read More »

1. Bubble Sort Bubble sort repeatedly compares and swaps(if needed) adjacent elements in every pass. In i-th pass of Bubble Sort (ascending order), last (i-1)… Read More »

Given an array arr[], the task is increment all the odd positioned elements by 1 and decrement all the even positioned elements by 1. Examples:… Read More »

Barclays recently visited my Campus. Eligibility criteria was cgpa > 7 and no live backlog . Only Comp and IT were allowed . Around 120… Read More »

Given an array arr[] of digits and an integer K, the task is to find num(arr) + K where num(arr) is the number formed by… Read More »

Given a linked list, the task is to find the sum of all the nodes which are greater than the node next to them. Note… Read More »

Given two arrays arr1[] and arr2[]. The task is to count the distinct sums that can be obtained while choosing a prime element from arr1[]… Read More »

Given a linked list, the task is to find the sum of even and odd nodes in it separately. Examples: Input: 1 -> 2 ->… Read More »

Matrix is nothing but a rectangular arrangement of data or numbers. In other words, it is a rectangular array of data or numbers. The horizontal… Read More »

Given an array arr[] of n integers and an integer k. The task is to maximize the sum of the array after performing the given… Read More »

Given the NxN grid of horizontal and vertical roads. The task is to find out the number of ways that the person can go from… Read More »

Given an array, the task is to print or display all the permutations of this array using STL in C++. Examples: Input: a[] = {1,… Read More »

Given a Binary tree, the task is to count the number of nodes with two children at a given level L. Examples: Input: 1 /… Read More »

Given the count of digits 1, 2, 3, 4. Using these digits you are allowed to only form numbers 234 and 12. The task is… Read More »

Given an array of n integers, we have to partition the array into three segments such that all the segments have equal sum. Segment sum… Read More »

Given a vector, find the sum of the elements of this vector using STL in C++. Example: Input: vec = {1, 45, 54, 71, 76,… Read More »

Given an array arr[] of N unique elements and Q queries. Every query consists of two integers L and R. The task is to print… Read More »

Given two integers A and B, the task is to calculate 22A % B. Examples: Input: A = 3, B = 5 Output: 1 223… Read More »