Skip to content

Category Archives: C++ Programs

Question: Write a function to find if a given integer x appears more than n/2 times in a sorted array of n integers. Basically, we need… Read More
Given a square matrix of order n*n, find the maximum and minimum from the matrix given.  Examples:  Input : arr[][] = {5, 4, 9, 2,… Read More
Given two positive integers x and y, check if one integer is obtained by rotating bits of other.  Input constraint: 0 < x, y <… Read More
This article discusses the basics of linear regression and its implementation in the C++ programming language. Regression analysis is the common analysis method that is… Read More
This article focuses on function/method overloads by references, as well as the types of arguments that can be passed. Prerequisites: l-value references. r-value references. Move… Read More
Write a function rotate(arr[], d, n) that rotates arr[] of size n by d elements. Example :  Input : arr[] = [1, 2, 3, 4, 5,… Read More
Given a singly linked list of 0s and 1s find its decimal equivalent. Input: 0->0->0->1->1->0->0->1->0 Output: 50 Input: 1->0->0 Output: 4 The decimal value of… Read More
Given a string, recursively remove adjacent duplicate characters from the string. The output string should not have any adjacent duplicates. See the following examples. Examples: … Read More
Given a singly linked list, swap kth node from beginning with kth node from end. Swapping of data is not allowed, only pointers should be… Read More
Given an array of distinct integers and a sum value. Find count of triplets with sum smaller than given sum value. The expected Time Complexity… Read More
Given K sorted linked lists of size N each, merge them and print the sorted output. Examples:  Input: k = 3, n = 4 list1… Read More
There are two singly linked lists in a system. By some programming error, the end node of one of the linked lists got linked to… Read More
Given two numbers represented by two lists, write a function that returns the sum list. The sum list is a list representation of the addition… Read More
Given an array a[0 . . . n-1]. We should be able to efficiently find the GCD from index qs (query start) to qe (query… Read More
Given a linked list and a value x, partition it such that all nodes less than x come first, then all nodes with a value… Read More

Start Your Coding Journey Now!