How to create ArrayList from Array in Java
The problem
If you have a traditional array, that looks something like the following:
A[] array = {new A(1), new A(2), new A(3)};
And you would like …
Read Article →342 articles about java development, tools, and best practices
If you have a traditional array, that looks something like the following:
A[] array = {new A(1), new A(2), new A(3)};
And you would like …
Read Article →Remove all vowels from the string.
Vowels:
a e i o u
A E I O U
Option 1:
public class VowelRemoval {
public …
Read Article →
You are given an array of unique elements, and your task is to rearrange the values so that the first max value is followed by the first …
Read Article →The most basic encryption method is to map a char to another char by a certain math rule. Because every char has an ASCII value, we can …
Read Article →Complete the function that takes an odd integer (0 < n < 1000000) which is the difference between two consecutive perfect squares, …
When given a string of space-separated words, return the word with the longest length.
If there are multiple words with the longest …
Read Article →You must implement a function that returns the difference between the biggest and the smallest value in a list(lst) received as a …
Read Article →Given a string and an array of integers representing indices, capitalize all letters at the given indices.
Example: …
Read Article →Modify the spacify function so that it returns the given string with spaces inserted between each character.
spacify("hello …
Read Article →
Write a simple regex to validate a username. Allowed characters are:
Length should be between 4 …
Read Article →Given two arrays of strings a1 and a2 return a sorted array r in lexicographical order of the strings of a1 which are substrings of …
Your task is to add up letters to one letter.
The function will be given an array of single-character Strings, each one being a letter …
Read Article →You want to create secret messages which must be deciphered.
Here are the conditions:
In this challenge, you have to write a method that folds a given array of integers by the middle x-times.
An example says more than a …
Read Article →Given a list lst and a number N, create a new list that contains each number of lst at most N times without reordering. For example if N …
Read Article →Write a function that accepts a string, and returns true if it is in the form of a phone number.
Assume that any integer from 0-9 in any …
Sort elements in an array by decreasing frequency of elements. If two elements have the same frequency, sort them by increasing value. …
Read Article →Write a function that receives two strings and returns n, where n is equal to the number of characters we should shift the first string …
Read Article →Compare two strings by comparing the sum of their values (ASCII character code).
null …Given two integers a, b, find The sum of them, BUT You are not allowed to use the operators + and –
Notes
Count how many arguments a method is called with.
Examples
args_count(1, 2, 3) -> 3
args_count(1, 2, 3, 10) -> 4
You are given a list/array which contains only integers (positive and negative). Your job is to sum only the numbers that are the same …
Read Article →You are given a string. You must replace any occurrence of the sequence coverage by covfefe, however, if you don’t find the word …
Your task is to write a function toLeetSpeak that converts a regular english sentence to Leetspeak.
More about LeetSpeak You can read at …
Read Article →