# Category: Problem Solving

## Write a java program for Simple String Manipulation.

Write a program to read a string and return a modified string based on the following rules. Return the String without the first 2 chars except when keep the first char if it is ‘j’ keep the second char if it is ‘b’. The return type (string) should be the modified string based on the

## Write a java program to find sum of common element in array.

Write a program to read two integer arrays and find the sum of common elements in both the arrays. If there are no common elements return -1 as output. The return type (integer) should be the sum of common elements. Assume that all the elements will be distinct. Input and Output Format: Input consists of

## Write a java program to find average of prime locations.

Write a program to read an integer array and find the average of the numbers located on the Prime location(indexes). Round the average to two decimal places. Assume that the array starts with index 0. The return type (double) should be the average Input and Output Format: Input consists of n+1 integers. The first integer

## Write a java program to Flush Characters.

Write a program to read a string from the user and remove all the alphabets and spaces from the String, and only store special characters and digit in the output String. Print the output string. The return type (String) should return the character removed string. Input and Output Format: Input consists of string. The output consists of a String

## Write a java program to create experience calculator.

Write a program to read Date of Joining and current date as Strings and Experience as integer and validate whether the given experience and calculated experience are the same. Print “true” if same, else “false”. Input and Output Format: Input consists of 2 strings and an integer, where the 2 strings correspond to the date of joining

## Write a java program to find the day of birth

Given an input as the date of birth of the person, write a program to calculate on which day (MONDAY, TUESDAY….) he was born to store and print the day in Upper Case letters. The return type of the output is a string which should be the day in which the person was born. Input and Output

## Write a java program to find Repeating set of characters in a string.

Get a string and a positive integer n as input. The last n characters should repeat the number of times given as second input.Write code to repeat the set of character from the given string. The return type of the output is a string with repeated n characters. Input and Output Format: Input consists a

## Write a java program to find Distance

Write a Program that accepts four int inputs(x1,y1,x2,y2) as the coordinates of two points. Calculate the distance between the two points using the below formula. Formula : square root of((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)) Then, Round the result to return an int. Input and Output Format: Input consists of four integers. The output consists of a single integer. Refer

## Write a java program to find Largest Difference.

Write a program to read an integer array, find the largest difference between adjacent elements and display the index of largest difference. EXAMPLE: input1: {2,4,5,1,9,3,8} output1: 4 (here largest difference 9-1=8 then return index of 9 ie,4) Input and Output Format: Input consists of an integer n which is the number of elements followed by

## Write a java program to String Processing

Write a program to read two strings and one int value(N). check if the Nth character of first String from the start and Nth character of second String from the end are same or not. If both are same return true else return false. Check need not be Case sensitive Input and Output Format: Input consists