
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 1860 Articles for Data Structure

162 Views
The problem statement includes using Vantieghems theorem for primality test i.e. we will check for a positive number N which will be user input and print if the number is a prime number or not using the Vantieghems theorem. Vantieghem’s Theorem The Vantieghems theorem for primality states that a positive number, N is a prime number if the product of $\mathrm{2^{i}−1}$ where the value of i ranges from 1 to N−1 is congruent to N modulo $\mathrm{2^{N}−1}$ If both the values are congruent then the number N is a prime number else it is not a prime number. Congruent ... Read More

176 Views
The problem statement includes finding the sum of range in a series of first odd numbers then even natural numbers up to N. The sequence consists of all the odd natural numbers from 1 to N and then all the even natural numbers from 2 to N, including N. The sequence will be of size N. We will be provided with a range in the problem for which we need to find out the sum of the sequence within that range, a and b i.e. [a, b]. Here a and b are included in the range. For example, we are ... Read More

301 Views
The problem statement includes printing the sum of product of consecutive binomial coefficients for any positive number, N which will be the user input. The positive coefficients in the binomial expansion of any term are called binomial coefficients. These binomial coefficients can be found out using Pascal's triangle or a direct formula. The formula to calculate the binomial coefficient: $$\mathrm{^nC_{r}=\frac{n!}{(n-r)!r!}}$$ where, n and r can be any positive numbers and r should never be greater than n. Note : The value of 0! is always equal to 1. In this problem, we will be given a positive number N and ... Read More

170 Views
The problem statement includes printing the sum of digits of N, which will be the user input, when written in different bases from 2 to N−1. In this problem, we will be provided any positive integer N and we need to represent that number in a different base numeral system from 2 to N−1 and find the sum of the digit of each different base numeral system. In the base−n numeral system, every digit of the representation of any number in that numeral system from right represents the number of times power of n from 0 to 31. For example, ... Read More

356 Views
The problem statement includes printing the sum of bitwise OR of all possible subsets of a given set. A set is a collection of data of similar type. A subset of any set is a set containing few elements of the set or all the elements of the given set. The number of subsets of any set is given by $\mathrm{2^{n}−1}$, where n is the number of elements in the given set. For example, a={1, 2, 3, 4, 5} is the given set. {1}. {2, 3}, {1, 2, 3, 4} and so on are called subsets of a, as they ... Read More

364 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

387 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

578 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

462 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