Program to Move zeros to end of integer array in java (example)
Given an array containing integers (+ve, -ve & 0), we would like to move zeros to end of array. We […]
Given an array containing integers (+ve, -ve & 0), we would like to move zeros to end of array. We […]
Given an array of integers in java. Print second smallest element in an array (in single iteration). We have already discussed
StringBuffer is a thread-safe, mutable sequence of characters. StringBuffer can be modified at any point of time. We will look
Difference between equality operator & equals method in java. == operator is used to compare primitives & equals method is used to compare objects (example)
Given an array of integers in java. Create two stacks using single array. We shall able to perform push &
Given an array of integers in java. Print second largest element in an array (in single iteration). Example – find second largest
Create or implement stack in java using array as underlying data structure. We will create stack class having following methods
Given two arrays, one array is almost duplicate array of another array. Arrays are duplicated except one element. e.g. array1[] =
Given an array containing positive & negative integers. We would like to find subarray having maximum sum. We will use
Given an integer array in java. Reverse input array using iterative & recursive algorithm. Example to reverse an integer array
A prime number is a natural number greater than 1 that has no positive divisors other than 1 & itself. e.g.Number 7
Given two sorted integer arrays containing unique or distinct elements. We would like to find out the union of two
Given two sorted arrays containing distinct elements. We would like to find out the intersection of two sorted arrays. Intersection
Given an array of integers in java. Replace every element of array with greatest number on its right. The right
Given an integer array in java, find out the leader elements in an array. What is leader element in an
Given an integer array in java, find the majority (element exist more than half element) element in an array using Boyer Moore’s voting algorithm.
Given an array containing n-1 distinct positive numbers range from 1 to n. e.g suppose n = 5, array will contain 4 unique
What is exception (background)? Exception occurs in an application mostly due to programming mistakes. e.g. NullPointerException occurs, when we try
What is user defined or custom exception in java? User defined exceptions is concrete class extending exceptions like Exception, RuntimeException
Create a user defined exception in java. Create a custom exception, by extending unchecked exceptions. We will create CustomArithmeticException by extending
Logical Question/ Puzzle: Five pirates & 100 gold coins in a ship Five pirates say P1 to P5 (youngest to
1. Problem Statement or Puzzle: Farmer standing on the bank of river and want to cross the river. Boat has
25 horses, 5 tracks & 3 fastest horses puzzle Given 25 horses and a racing track. 5 horses can run simultaneously
Four person crossing collapsing bridge & torch puzzle: Four persons wants to cross a bridge at night. There is one
Question: box of defective balls puzzle or logical interview question You are given 10 boxes containing balls. The 9 boxes
Ants on equilateral triangle puzzle: Three ants are sitting on the corners of equilateral triangle. Ants can pick any direction
Lady, shopKeeper & 1000$ fake note puzzle Shopkeeper A is selling the goods at no profit no loss (zero profit).
GoldBar work payment logical interview question or puzzle: Given a gold bar that will be used to make a payment to a worker for seven days.
What is Single Responsibility Principle? Single Responsibility Principle is one of the five principles of SOLID acronym. Single Responsibility Principle
Interface segregation principle (ISP) is one of the five principles of SOLID acronym. Interface Segregation Principle states “Clients should not