Java Program to Reverse a Number without using Recursion

This is the Java Program to Reverse a Given Number Without Using Recursion. Problem Description Write a Java Program to Reverse a Given Number Without Using Recursion. Problem Solution Using a loop, extract the last digit of the number and add it at the end of the reverse formed till now. . Program/Source Code Here … Read more

advertisement

Java Program to Find the Sum of the Series 1/1!+1/2!+1/3!+…1/N!

This is the Java Program to Find the Sum of the Series 1/1!+1/2!+1/3!+…1/N!. Problem Description Given a number n, write a Java Program to Find the Sum of the Series 1/1!+1/2!+1/3!+…1/N!. Problem Solution Start a loop from 1 to n, and add the factorial of the reciprocal of the loop variable to the sum. The … Read more

advertisement

Java Program to Find the Sum of the Series 1/1+1/4+1/9+…1/N^2

This is the Java Program to Find the Sum of the Series 1/1+1/4+1/9+…1/N2. Problem Description Given a number n, write a java program to find the sum of the series 1/1+1/4+1/9+…1/N2. Problem Solution Start a loop from 1 to n, and add the square of the reciprocal of the loop variable to the sum. Program/Source … Read more

advertisement

Codility Passing Car Problem in Java

This is the Java Program to Solve the passing Car Codility Problem. Problem Description Given a boolean array of 0’s and 1’s, where 0’s represent cars going to east and 1’s represent cars going to the west. Find out the pairs of the cars that will cross each other, that is, the pairs of cars … Read more

advertisement

Java Program to Find the Sum of the Series 1/1+1/2+1/3+…1/N

This is the Java Program to Find the Sum of the Series 1/1+1/2+1/3+…1/N. Problem Description Given a number n, write a java program to find the sum of the series 1/1+1/2+1/3+…1/N. Problem Solution Start a loop from 1 to n, and add the reciprocal of the loop variable to the sum. Program/Source Code Here is … Read more

advertisement

Java Program to Find the Length of Longest Repeating Sequence in a String

This is the Java Program to Find the Length of the Longest Repeating Sub-sequence in a String. Problem Description Given a string s, find and print the length of the longest repeating subsequence in the string, that is, the length of the subsequence consisting of some of the characters in the original string, which are … Read more

advertisement

Dutch National Flag Problem in Java

This is the Java Program to Solve the Dutch National Flag Problem. Problem Description Given an array of 0’s, 1’s and 2’s, all the elements in the random order, sort the array in linear time, without using extra space. This is known as the Dutch National Flag problem. Example: Array = [1 0 2 2 … Read more

advertisement

Java Program to Replace Elements with Greatest Element on Right Side

This is the Java Program to Replace the Element with its Next Greatest Element, Rightmost Element will be Replaced by 0. Problem Description Given an array of integers, replace each element of the array with the greatest element present on the right side of the element, in the array. The rightmost element or the last … Read more

advertisement

Java Program to Find the Smallest Positive Number Missing from an Unsorted Array

This is the Java Program to Find the Smallest Positive Integer Missing in an Unsorted Integer Array. Problem Description Given an array of integers, find out the smallest positive integer missing from the array. Example: Array = [-1, -3, 3, 2, 8 ,6] Output: 1. Problem Solution First sort the array. Then initialize a variable … Read more

advertisement

Java Program to Convert a String to an Integer Array

This is the Java Program to Convert a String to an Integer Array. Problem Description Given a string consisting of various numbers separated by spaces, convert it into an array of Integers, such that every number occupies a position in the array, and for every invalid number, there is a -1 in the array. Example: … Read more

advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.