
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 7197 Articles for C++

361 Views
The problem statement includes printing the sum of the series whose Nth term is given. The value of N will be given in the input. We need to find the sum of the sequence up to N where the Nth term of the sequence is given by: $$\mathrm{N^{2}−(N−1)^{2}}$$ Let’s understand the problem with the below examples: Input N=5 Output 25 Explanation − The value of N given is 5.The first 5 terms of the sequence are: $\mathrm{N=1, 1^{2}−(1−1)^{2}=1}$ $\mathrm{N=2, 2^{2}−(2−1)^{2}=3}$ $\mathrm{N=3, 3^{2}−(3−1)^{2}=5}$ $\mathrm{N=4, 4^{2}−(4−1)^{2}=7}$ $\mathrm{N=5, 5^{2}−(5−1)^{2}=9}$ The sum of the terms of the sequence until 5th ... Read More

378 Views
The problem statement includes printing the count of numbers within a range given that can be expressed as power of two numbers i.e. numbers which are perfect powers. The numbers which are known as perfect powers is the number which can be expressed as $\mathrm{x^{y}}$, where x>0 and y>1 for all integers. For example, 8 is a perfect power because it can be expressed as $\mathrm{2^{3}}$, which is equal to 8 hence it is considered as a perfect power. In this problem, we will be given a range as two positive integers in the input i.e. a and b ... Read More

574 Views
The problem statement includes finding the minimum number of digits to remove from a number to make a number perfect square. A perfect square denoted as $\mathrm{x^{2}}$ is a positive integer which is a product of an integer with itself. We will be given a positive number N and we need to find the minimum number of digits we can remove from the number N to make it a perfect square i.e. such that it is a product of some integer with itself. For example, N=42 We can remove 1 digit from N i.e. 2 to make it a perfect ... Read More

457 Views
We will discuss the Java Math subtractExact(long x, long y) method in Java and understand its functionalities and working. The subtractExact()is an inbuilt function in the Java Math library. The function returns the difference between the two parameters passed as arguments in the function. The function returns an exception when the returned value overflows the range of values of a particular data type. It is the most commonly used class for mathematical operations is the java.lang.Math class is a part of the Java Standard Library and is included in the java.lang package. Syntax Following is the syntax of the subtractExact() function ... Read More

331 Views
The problem statement includes checking if the given number N, which will be the user input, is a hoax number or not. A Hoax number is a composite number whose sum of digits of its distinct prime factors is equal to the sum of the digits of the composite number itself. Since 1 is not a prime number, we don’t consider 1 as a sum of digits of distinct prime numbers. If a prime number is a factor of the composite number more than once, it is just considered once while taking the sum of digits of prime factors. In ... Read More

256 Views
The Hardy−Ramanujan Theorem states that the number of distinct prime factors of any natural number N will be approximately equal to the value of $\mathrm{\log(\log N)}$ for most of the cases. For example, let’s consider N to be 1000. The number of distinct prime factors of 15 are 2 and 5 i.e. 2 distinct prime factors. The value of $\mathrm{\log_{e}(\log_{e}(1000))}$ is equal to 1.932 which is approximately equal to 2. The Hardy−Ramanujan theorem is proved in the above case. Since the theorem states that the number of distinct prime factors will be approximately equal to $\mathrm{\log(\log(N))}$ for most of ... Read More

354 Views
The problem statement includes finding the number of digits in N when represented in any base b numeral system. Initially, N is given in the base−10 numeral system. In the problem, we will be provided with a positive integer N in the input which will be in the base−10 numeral system and a positive integer b greater than 1. Our task will be to find the number of digits when N is being represented in the base−b numeral system. Any number represented in any base number, every digit from right represents the number of times power of that base number ... Read More

177 Views
The problem statement includes counting the numbers formed by the given two digits, x and y of size N with sum having given digits only i.e. x and y. We need to count the distinct numbers which can be formed by the digits, x and y which will be the user input of size N where N ranges from 1 to 10^6. The N will also be provided in the input. The numbers formed using the digits, x and y of size N must be such that the sum of digits of the numbers formed should have only digits ... Read More

1K+ Views
The objective of this article is to determine the smallest string that is a multiple of both given strings. An interesting observation to note is that for two given strings s and t, the string s is a multiple of t if and only if s can be formed by repeating t one or more times. We have to find the smallest such string. Problem Statement Given two non-empty strings, s1 and s2, with lengths n and m respectively, the objective is to determine the smallest string that is a multiple of both s1 and s2. A ... Read More