Posts from C++

Find nth element of Stern’s Diatomic Series in C++

By Abinash Reddy

In this article, we will learn how to find the nth element of Stern’s Diatomic Series in C++. Stern’s Diatomic Series is a sequence 1, 1, 2, 1, 3, 2, 3, 1, 4, 3, 5 …. whi.... Read More

Best algorithm to generate all prime numbers up to a given range in C++

By Vikram singhal

In online coding contests, we often come across problems that are related to primality testing. So, why not we should learn about the algorithm, that can generate all possible prim.... Read More

C++ program to generate CAPTCHA and verify user

By Abinash Reddy

A CAPTCHA is a test to check whether the user is a human or not. CAPTCHA verification is very widely used to determine the user is a human or machine. In this article, we will impl.... Read More

C++ program to check whether a matrix is scalar or not

By Abinash Reddy

In this article, we will learn how to check whether a given matrix is scalar or not in C++. A square matrix is said to a scalar if all the diagonal elements of the matrix are equal.... Read More

C++ Program to Check if two trees are Identical

By Abinash Reddy

In this article, we will learn how to implement a program to check whether the given two trees are identical or not in C++. Two trees are said to identical when they have the same .... Read More

Chinese Remainder Theorem with solution in C++

By Srirama Charan

Today we will see a rather interesting problem called the Chinese remainder problem and try to understand the theory behind it. The Chinese Remainder theorem was first introduced b.... Read More

The Two Knights Problem (Implemented in C++)

By Srirama Charan

The two knights problem is a general mathematical challenge, where we have to find the total number of ways to place two knights on an nxn chessboard such that they do not attack e.... Read More

Lexicographic Rank of a Word in C++

By Srirama Charan

Today, we will see how to find the lexicographic rank of a string in C++. The lexicographic rank of a string means the rank of the given string in a list of permutations of the giv.... Read More