Java Program to Print the Longest Increasing Subarray

This is the Java Program to Print the Longest Sub-Array that is increasing. Problem Description Given an array of integers, find the longest contiguous subarray whose elements are increasing, that is, the elements following the preceding elements in the subarray must be greater than them. Example: Array = [5, 6, 3, 0, 7, 8, 9, … Read more

advertisement

Java Program to Remove Duplicate Elements from Array

This is the Java Program to Remove Duplicates in a Sorted Array. Problem Description Given a sorted array of integers, remove the duplicates of the elements from the array. Example: Array = [1 2 2 3 3 4] Output Array = [1 2 3 4] Problem Solution Traverse the array from beginning to end and … Read more

advertisement

Smallest Sum Contiguous Subarray in Java

This is the Java Program to Find the Minimum Sum in a Contiguous Sub-Array. Problem Description Given an array of integers, find the contiguous subarray, whose sum of the elements, is minimum. Example: Array = [2 1 3 5 -2 1 -3 8] Output Subarray = [-2 1 -3] Sum = -4 Problem Solution The … Read more

advertisement

Java Program to Print Odd Elements at Even Index

This is the Java Program to Print Odd Elements at Even Index Number. Problem Description Given an array of integers, print the odd numbers present at even index numbers. Example: Array = [2,1,4,4,5,7] Output = 5 Problem Solution Iterate through the array, and check whether the current index is even or odd if it is … Read more

advertisement

Java Program to Print Even Elements at Odd Index

This is the Java Program to Print Even Elements at Odd Index Number. Problem Description Given an array of integers, print the even numbers present at odd index numbers. Example: Array = [2,1,4,4,5,7] Output = 4 Problem Solution Iterate through the array, and check whether the current index is even or odd if it is … Read more

advertisement

Java Program to Move All Zeros to the End of an Array

This is the Java Program to Shift the 0’s in an Array to the End. Problem Description Given an array of integers, shift all the zeroes present in it to the end. Example: Array = [1 0 2 3 0 4] Output Array = [1 2 3 4 0 0] Problem Solution Traverse the array … Read more

advertisement

Java Program to Find the Largest Subarray with Equal Number of 0s and 1s

This is the Java Program to Find the Largest sub-Array consisting of Equal Number of 0’s and 1’s. Problem Description Given an array, find out the longest subarray consisting of the equal number of zeroes and ones. Example: ArrayOne = [1, 2, 0, 5, 6, 0, 1, 0] Output 1 2 0 5 6 0 … Read more

advertisement

Java Program to Check if an Array is Decreasing

This is the Java Program to Check if an Array is Strictly Decreasing. Problem Description Given an array of integers check whether it is strictly decreasing or not. A strictly decreasing array is an array whose each element is smaller than it’s preceding element. Example: Array = [5, 4, 3, 2, 1] Output: Array is … Read more

advertisement

Java Program to Move All Zeros to the Start of an Array

This is the Java Program to Shift the 0’s in an Array to the Beginning. Problem Description Given an array of integers, shift all the zeroes present in it to the beginning. Example: Array = [1 0 2 3 0 4] Output Array = [0 0 1 2 3 4] Problem Solution Traverse the array … Read more

advertisement

Java Program to Merge Two Arrays Without Extra Space

This is the Java Program to Merge Two Arrays Without Extra Space in Order. Problem Description Given two sorted arrays, merge both the arrays in order without using extra space. Example: ArrayOne = [ 2, 3, 7, 8, 9] ArrayTwo = [-2, -1, 1, 4, 5] Output ArrayOne = [-2, -1,, 1, 2, 3] ArrayTwo … 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.