Professional Documents
Culture Documents
Java Assignment
Java Assignment
Java Assignment
2. Print all permutations of a given String. For example, if given String is "GOD" then your program
should print all 6 permutations of this string e.g. "GOD", "OGD", "DOG", "GDO", "ODG", and
"DGO"
3. Given two sorted arrays, merge them such that the elements are not repeated
4. Write a program to give the following output for the given input
5. Given a string, return the "reversed" string where all characters that are not a letter stay in the
same place, and all letters reverse their positions.
Example1: Input: "ab-cd" Output: "dc-ba"
Example2: Input: " Test1ng-Leet=code-Q!" Output: " Qedo1ct-eeLg=ntse-T!"
6. Given a paragraph and a list of banned words, return the most frequent word that is not in the
list of banned words.
Input: = "Bob hit a ball, the hit BALL flew far after it was hit."
banned = ["hit"]
Output: "ball"
7. Given an array length 3 or more of ints, return the difference between the largest and smallest
values in the array.
8. Given an array of strings, return a Map<String, Integer> with a key for each different string, with
the value the number of times that string appears in the array.
Input : ["a", "b", "a", "c", "b"] Output: {"a": 2, "b": 2, "c": 1}
9. Write a Java program to convert a string to date (showing date, month, year, time(hours,
minute, secs) with time zone)