Simple string expansion in Java
The challenge
Consider the following expansion:
// because "ab" repeats 3 times
solve("3(ab)") == "ababab"
// because …
Read Article →
In-depth guides, insights, and best practices for modern software engineering
Consider the following expansion:
// because "ab" repeats 3 times
solve("3(ab)") == "ababab"
// because …
Read Article →
A Hamming number is a positive integer of the form 2i3j5k, for some non-negative integers i, j, and k.
Write a function that computes …
Read Article →Consider the following array:
[1, 12, 123, 1234, 12345, 123456, 1234567, 12345678, 123456789, 12345678910, 1234567891011...]
If we join …
Read Article →Create a RomanNumerals class that can convert a roman numeral to and from an integer value. It should follow the API demonstrated in the …
Read Article →Given a number of points on a plane, your task is to find two points with the smallest distance between them in linearithmic O(n log n) …
Read Article →Given a square matrix (i.e. an array of subarrays), find the sum of values from the first value of the first array, the second value of …
Read Article →You will be given a list of strings representing nodes in a rooted tree. A visual representation of a very simple rooted tree could be: …
Read Article →A pangram is a sentence that contains every single letter of the alphabet at least once. For example, the sentence “The quick …
Read Article →In this challenge you are given a string for example:
"example(unwanted thing)example"
Your task is to remove everything inside …
Read Article →Return the century of the input year. The input will always be a 4 digit string, so there is no need for validation.
An ordered sequence of numbers from 1 to N is given. One number might have deleted from it, then the remaining numbers were mixed. Find …
Read Article →In this challenge, we are going to reverse a string while maintaining the spaces (if any) in their original place.
For example: …
Read Article →Take the following IPv4 address: 128.32.10.1
This address has 4 octets where each octet is a single byte (or 8 bits).
128 has …The drawing shows 6 squares the sides of which have a length of 1, 1, 2, 3, 5, 8. It’s easy to see that the sum of the perimeters …
Read Article →Number is a palindrome if it is equal to the number with digits in reversed order. For example, 5, 44, 171, 4884 are palindromes, and 43 …
You are given an array of strings and your task is to remove all consecutive duplicate letters from each string in the array.
For …
Read Article →Given a list of numbers, determine whether the sum of its elements is odd or even.
Give your answer as a string matching "odd" …
In this challenge, you have to create all permutations of an input string and remove duplicates if present. This means you have to …
Read Article →You will be given a certain array of length n, such that n > 4, having positive and negative integers but there will be no zeroes and …
Consider the numbers 6969 and 9116. When you rotate them 180 degrees (upside down), these numbers remain the same. To clarify, if we …
In this challenge your mission is to rotate matrix counter-clockwise N times.
So, you will have 2 inputs:
1) matrix
2) a number, how …
Read Article →
If you receive the following error message when trying to run pymysql on AWS Lambda:
Unable to import module "lambda_function": No module …
Write a function that accepts two square (NxN) matrices (two dimensional arrays), and returns the product of the two. Only square …
Complete the function that takes 3 numbers x, y and k (where x ≤ y), and returns the number of integers within the range [x..y] (both …