This Java 8 challenge tests your knowledge of Lambda expressions! Write the following methods that return a lambda expression performing a specified action: PerformOperation isOdd(): The lambda expression must return if…
Java annotation can be used to define the metadata of a Java class or class element. We can use Java annotation at the compile time to instruct the compiler about the build process. Annotation is also used at runtime to…
You are given a class Solution and an inner class Inner.Private. The main method of class Solution takes an integer as input. The powerof2 in class Inner.Private checks whether a number is a power of . You have to call…
In computer science, a priority queue is an abstract data type which is like a regular queue, but where additionally each element has a "priority" associated with it. In a priority queue, an element with high priority…
In computer science, a double-ended queue (dequeue, often abbreviated to deque, pronounced deck) is an abstract data type that generalizes a queue, for which elements can be added to or removed from either the front…
Comparators are used to compare two objects. In this challenge, you'll create a comparator and use it to sort an array. The Player class is provided for you in your editor. It has fields: a String and a integer. Given…
A string containing only parentheses is balanced if the following is true: 1. if it is an empty string 2. if A and B are correct, AB is correct, 3. if A is correct, (A) and {A} and [A] are also correct. Examples of some…
Let's play a game on an array! You're standing at index of an -element array named . From some index (where ), you can perform one of the following moves: Move Backward: If cell exists and contains a , you can walk back…
Java's BigDecimal class can handle arbitrary-precision signed decimal numbers. Let's test your knowledge of them! Given an array, , of real number strings, sort them in descending order — but wait, there's more! Each…
In a tag-based language like XML or HTML, contents are enclosed between a start tag and an end tag like <tag>contents</tag>. Note that the corresponding end tag starts with a /. Given a string of text in a tag-based…
In this challenge, we use regular expressions (RegEx) to remove instances of words that are repeated more than once, but retain the first occurrence of any case-insensitive repeated word. For example, the words love and…
Given a string , print Yes if it is a palindrome, print No otherwise. Constraints will consist at most lower case english letters. Sample Input Sample Output Solution in java8 Approach 1. Approach 2.