# Author: vishal naik

## Create and start a new thread in java

This is the basic question asked in any entry-level Java interview. Knowledge of threads is very important to be an efficient and good Java programmer. We will see how …

## Find minimum distance to reach nearest 0

Problem: Given a matrix of -1’s and 0’s, display matrix which contains minimum distance to reach nearest 0 for that particular position. Example: Input matrix: -1 0 -1 -1 -1 …

## Find number of customers who left without using a computer

Problem: Find number of customers who left without using a computer. This program was asked in makeMyTrip interview. Western union owns several cyber cafes. A research firm did an analysis …

## Find next greater number with same set of digits in Java

Problem: Given a number, find next greater number with the same set of digits as original number. For example, if input number is 1234, then output should be 1243 if …

## Check if characters of a given string can be rearranged to form a palindrome

Problem: Check if characters of a given string can be rearranged to form a palindrome. Or, write a Java program to check if a given string is a rotation …

## Alternating characters Hackerrank Java solution

Problem: Given a string, find minimum number of deletions required so that there will be no two consecutive repeating characters in the string. This is one of the challenge …

## Reverse a number using stack in Java

Problem: Reverse a number using stack data structure. Stack is a LIFO (Last In First Out) data structure. i.e. last element pushed onto the stack is popped out first. Java provides in-built stack …

## Find a maximum number that can be formed from digits of a number

Problem: Write a Java program to find a maximum number that can be formed from the digits of a given number. For example: If the given number is 38293367, then …

## Find two numbers that add to a sum in an array in Java

Problem: Write a Java program to find two numbers that add to a sum in an array. A solution of time complexity Ο(n) is expected. Example: If the input …

## Distinct elements in an array

Problem: Write a Java program to find distinct elements in an array. For example, if input array is { 2, 4, 3, 2, 6, 9, 4, 6 } then, …