# Java

## Find the Sums of Perfect Squares in Java

The challenge The task is simply stated. Given an integer n (3 < n < 109), find the length of the smallest list of perfect squares which add up… Read More »Find the Sums of Perfect Squares in Java

## Solved: Error – no main manifest attribute

You’ve built a Java project and packaged a .jar file. You are ready to run it outside your IDE, or deploy it somewhere. When you… Read More »Solved: Error – no main manifest attribute

## How to Make a Spiral in Java

The challenge Your task, is to create a NxN spiral with a given size. For example, spiral with size 5 should look like this: 00000 ….0… Read More »How to Make a Spiral in Java

## Find the Longest Common Subsequence in Java

The challenge from Wikipedia:The longest common subsequence (LCS) problem is the problem of finding the longest subsequence common to all sequences in a set of sequences.It… Read More »Find the Longest Common Subsequence in Java

## Determine if Number is a Power of Three in Java

The challenge Given an integer n, return true if it is a power of three. Otherwise, return false. An integer n is a power of three, if there exists an integer x such… Read More »Determine if Number is a Power of Three in Java

## How to Count Binary Substrings in Java

The challenge Give a string s, count the number of non-empty (contiguous) substrings that have the same number of 0’s and 1’s, and all the 0’s… Read More »How to Count Binary Substrings in Java

## Array Range between Integers in Java

The challenge Complete the function that takes two integers (a, b, where a < b) and return an array of all integers between the input parameters, including them.… Read More »Array Range between Integers in Java

## Number of Rectangles in a Grid in Java

The challenge Given a grid of size m x n, calculate the total number of rectangles contained in this rectangle. All integer sizes and positions… Read More »Number of Rectangles in a Grid in Java

## Longest vowel chain in Java

The challenge The vowel substrings in the word codewarriors are o,e,a,io. The longest of these has a length of 2. Given a lowercase string that has alphabetic characters… Read More »Longest vowel chain in Java

## Determine Unique String Characters in Java

The challenge In this challenge, you will be given two strings a and b and your task will be to return the characters that are not common in the… Read More »Determine Unique String Characters in Java

## Difference of Volumes of Cuboids in Java

The challenge In this simple exercise, you will create a program that will take two lists of integers, a and b. Each list will consist of 3 positive… Read More »Difference of Volumes of Cuboids in Java

## Sort by binary ones in Java

The challenge In this example you need to implement a function that sort a list of integers based on it’s binary representation. The rules are… Read More »Sort by binary ones in Java

## Binomial Expansion in Java

The challenge Write a program that can do some algebra. Write a function expand that takes in an expression with a single, one character variable, and expands… Read More »Binomial Expansion in Java

## Consecutive strings in Java

The challenge You are given an array(list) strarr of strings and an integer k. Your task is to return the first longest string consisting of k consecutive strings taken in the array.… Read More »Consecutive strings in Java

## Determine the Highest Scoring Word in Java

The challenge Given a string of words, you need to find the highest scoring word. Each letter of a word scores points according to its… Read More »Determine the Highest Scoring Word in Java

## Solving Speed Control in Java

The challenge In John’s car the GPS records every s seconds the distance travelled from an origin (distances are measured in an arbitrary but consistent unit). For… Read More »Solving Speed Control in Java

## Find the Greatest Common Divisor in Java

The challenge Find the greatest common divisor of two positive integers. The integers can be large, so you need to find a clever solution. The… Read More »Find the Greatest Common Divisor in Java

## How to Guess the Sequence in Java

The challenge You must guess a sequence and it has something to do with the number given. Example The solution in Java code Option 1:… Read More »How to Guess the Sequence in Java

## Reversed sequence in Java

The challenge Build a function that returns an array of integers from n to 1 where n>0. Example : n=5 –> [5,4,3,2,1] The solution in Java code Option 1:… Read More »Reversed sequence in Java

## Count the Digit in Java

The challenge Take an integer n (n >= 0) and a digit d (0 <= d <= 9) as an integer. Square all numbers k (0 <= k <= n) between… Read More »Count the Digit in Java

## Multiply all elements in an array in Java

The challenge Create a function multiplyAll/multiply_all which takes an array of integers as an argument. This function must return another function, which takes a single integer as… Read More »Multiply all elements in an array in Java