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
 
Programming Articles - Page 2148 of 3366
 
			
			151 Views
In this problem, we are given an integer N and we have to print all safe prime number whose values are less than N.A safe prime number is a prime number which can be represented as [(2*p)- 1] where p is also a prime number.Examples − 5[(2*2) +1] , 7[(2*3)+1].Let’s take a few examples to understand the problem better −Input: N = 12 Output: 5 7 11.To solve this problem, we will find all the prime numbers less than N(for this we will use Sieve of Eratosthenes). And check if the prime number is a safe prime number or not ... Read More
 
			
			545 Views
In this problem, we are given an integer N. and we have to print all the semiprime numbers that are less than or equal to N.Before solving this problem, let’s understand what is a semi-prime number.A semi-prime number is a number whose value is the product of two distinct prime numbers.Let’s take an example, 21 = 3*7 is a semiprime number.25 = 5*5 is not a semiprime number.Now, let’s take an example of semiprime numbers less than or equal to n.Input: N = 15 Output: 6 10 14 15To solve this problem, we have to take each number less than ... Read More
 
			
			771 Views
In this problem, we are given two integer values, k, and n. And we have to print all the sequences of length k from numbers from 1 to n in sorted order.Let’s take an example to understand the topic −Input:k = 2 ; n = 3 Output: 1 1 1 2 1 3 2 1 2 2 2 3 3 1 3 2 3 3So in this problem, we have to print the sequence as stated above.A simple way to solve this problem is by incrementing integers of the sequence till they get to the max value i.e. n. The ... Read More
 
			
			132 Views
In this problem, we are given three variables n, s, and k and we have to print all the possible sequences that start with the number n and length s having the absolute difference between consecutive elements less than k.Let’s take an example to understand the topic better −Input: n = 3, s = 3 , k = 2 Output: 3 3 3 3 3 4 3 3 2 3 4 4 3 4 5 3 4 3 3 2 2 3 2 3 3 2 1In this problem, we need to obtain the absolute difference less k. For this, ... Read More
 
			
			1K+ Views
A text editor is a kind of program used for modifying simple text records. Such packages are repeatedly often called “notepad” application, following the Microsoft Notepad. This article explains about -“Top 5 Best Linux Text Editors”Vi EditorVim is a pre-set up text editor that’s upwards suitable to Vi. It may be used to edit all sorts of plain textual content. It is exceptionally priceless for enhancing packages.To open Vi editor, use the following command –$viThe sample output should be like thisTo get the more infomation about Vi editor, use the following command –$ vi --helpThe sample output should be like ... Read More
 
			
			833 Views
In this problem, we are given an array and we have to print all the subset of a given size r that can be formed using the element of the array.Let’s take an example to understand the topic better −Input: array = {3, 5, 6} r = 2 Output: 3 5 3 6 5 6In this problem, we will have to find all the combinations of the numbers of the array. And exclude those r bit combinations which are already in the set.Example Live Demo#include using namespace std; void printSubset(int arr[], int n, int r, int index, int data[], int ... Read More
 
			
			282 Views
LongBinaryOperator is a part of the functional interface from java.util.function package. This functional interface expects two parameters of type long as the input and produces a long type result. LongBinaryOperator interface can be used as an assignment target for a lambda expression or method reference. It contains only one abstract method, applyAsLong().Syntax@FunctionalInterface public interface LongBinaryOperator { long applyAsLong(long left, long right) }Example of Lambda Expressionimport java.util.function.LongBinaryOperator; public class LongBinaryOperatorTest1 { public static void main(String[] args) { LongBinaryOperator multiply = (a, b) -> { // lambda expression return a*b; }; long a = ... Read More
 
			
			226 Views
In this problem, we are given an integer n. And we have to print all substrings of a number that can be formed but converting the string are not allowed i.e. we cannot convert an integer into string or array.Let’s take an example to understand the topic better −Input: number =5678 Output: 5, 56, 567, 5678, 6, 67, 678, 7, 78, 8In order to solve this problem, we will need to use mathematical logic. Here, we will print the most significant bit first, then successive bits are printed.AlgorithmStep1: Take a 10’s power number based on the number of digits. Step2: ... Read More
 
			
			212 Views
In this problem, we are given an array of N elements. And need to return all the sums of the elements are divisible by an integer M.Input : array = {4, 7, 3} ; M = 3 Output : 5+4+3 ; 5+4-3To solve this problem, we need to know the concept of a power set that can be used to find all the possible sums obtained. From this sum, print all those which are divisible by M.AlgorithmStep 1: Iterate overall combinations of ‘+’ and ‘-’ using power set. Step 2: If the sum combination is divisible by M, print them ... Read More
 
			
			2K+ Views
In this problem, we are given an undirected graph and we have to print all the cycles that are formed in the graph.Undirected Graph is a graph that is connected together. All the edges of the unidirectional graph are bidirectional. It is also known as an undirected network.Cycle in a graph data structure is a graph in which all vertices form a cycle.Let’s see an example to understand the problem better −Graph-Output-Cycle 1: 2 3 4 5 Cycle 2: 6 7 8For this, we will make use of a few properties of the graph. You need to use graph coloring ... Read More