Skip to content

Category Archives: Java Programs

Given an array of numbers, arrange them in a way that yields the largest value. For example, if the given numbers are {54, 546, 548,… Read More
Using pointers, loop through the whole list and keep track of the node prior to the node containing the last occurrence key using a special… Read More
Algorithm For Java:In Java, automatic garbage collection happens, so deleting a linked list is easy. Just need to change head to null. Implementation: Java //… Read More
Given a linked list handling string data, check to see whether data is palindrome or not? Examples: Input: a -> bc -> d -> dcb… Read More
Given n numbers (both +ve and -ve), arranged in a circle, find the maximum sum of consecutive numbers.  Examples:  Input: a[] = {8, -8, 9,… Read More
Given singly linked list with every node having an additional “arbitrary” pointer that currently points to NULL. We need to make the “arbitrary” pointer to… Read More
Given a Linked List and a number n, write a function that returns the value at the n’th node from the end of the Linked… Read More
Given an array, only rotation operation is allowed on array. We can rotate the array as many times as we want. Return the maximum possible… Read More
Given a boolean 2D matrix, find the number of islands. A group of connected 1s forms an island. For example, the below matrix contains 5… Read More
Given a sorted array of n distinct integers where each integer is in the range from 0 to m-1 and m > n. Find the… Read More
Number is represented in linked list such that each digit corresponds to a node in linked list. Add 1 to it. For example 1999 is… Read More
Given an array, print the Next Greater Element (NGE) for every element. The Next greater Element for an element x is the first greater element… Read More
Given two lists sorted in increasing order, create and return a new list representing the intersection of the two lists. The new list should be… Read More
Given a singly linked list, find the middle of the linked list. For example, if the given linked list is 1->2->3->4->5 then the output should… Read More

Start Your Coding Journey Now!