Posts by Vikram singhal

Author Biographical Info: Optimistic, Elegant , Delegant

Find whether n! is divisible by sum of first n natural integers or not in C++

By Vikram singhal

Given an integer value n. Product of first n natural integers or n! (factorial of n )is denoted by P  and the sum of first n consecutive natural integers is denoted by S. If S is .... 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

Count of palindromic substrings in a string in C++

By Vikram singhal

Problem statement: Given a string, the task is to count the number of palindromic substrings present in this string. If any 2 substrings are identical but they have different start.... Read More

Set container and it’s important functions in C++ STL

By Vikram singhal

Introduction Set is an associative container present in C++ STL (Standard Template Library) that stores unique objects as keys. Set does not consider duplicate values. In the set, .... Read More

Maximum k-length sequence of divisors of a given integer in C++

By Vikram singhal

It’s a number theory problem and can also be categorized under constructive algorithm problems pre-requisites: Prime-factorization PROBLEM STATEMENT: Given an integer N.Our.... Read More

matrix spiral printing in C++

By Vikram singhal

Problem statement Given a matrix of r rows and c columns, print the matrix in spiral form with C++ program. Example: 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 .... Read More

Ceiling of every element of array on their right side elements in C++

By Vikram singhal

Problem statement Given an array of integers, determine the ceiling (the closest element that is greater than or equal to that element) on the elements present on the right side of.... Read More