code
stringlengths
160
48.7k
prompt
stringlengths
55
1.51k
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Given a positive integer n, you have to make a pile of n levels of stones. The first level has n stones. The number of stones in the next level is: - the next odd number if n is...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Given a positive integer n, you have to make a pile of n levels of stones. The first level has n stones. The number of stones in the next level is: - the next odd number if n is odd. ...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** You will be given a string of words separated by commas or spaces. Your task is to split the string into words and return an array of the words. For example: words_string("Hi, ...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** You will be given a string of words separated by commas or spaces. Your task is to split the string into words and return an array of the words. For example: words_string("Hi, my name is Joh...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** This function takes two positive numbers x and y and returns the biggest even integer number that is in the range [x, y] inclusive. If there's no such number, then the function should r...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** This function takes two positive numbers x and y and returns the biggest even integer number that is in the range [x, y] inclusive. If there's no such number, then the function should return -1. ...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** You are given two positive integers n and m, and your task is to compute the average of the integers from n through m (including n and m). Round the answer to the nearest integer and co...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** You are given two positive integers n and m, and your task is to compute the average of the integers from n through m (including n and m). Round the answer to the nearest integer and convert that to ...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Given a list of positive integers x. return a sorted list of all elements that hasn't any even digit. Note: Returned list should be sorted in increasing order. For example: ...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Given a list of positive integers x. return a sorted list of all elements that hasn't any even digit. Note: Returned list should be sorted in increasing order. For example: >>> uniqueDi...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Given an array of integers, sort the integers that are between 1 and 9 inclusive, reverse the resulting array, and then replace each digit by its corresponding name from "One", "Two", "...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Given an array of integers, sort the integers that are between 1 and 9 inclusive, reverse the resulting array, and then replace each digit by its corresponding name from "One", "Two", "Three", "Four"...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Implement the function f that takes n as a parameter, and returns a list of size n, such that the value of the element at index i is the factorial of i if i is even or the sum of number...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Implement the function f that takes n as a parameter, and returns a list of size n, such that the value of the element at index i is the factorial of i if i is even or the sum of numbers from 1 to i ...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Given a positive integer n, return a tuple that has the number of even and odd integer palindromes that fall within the range(1, n), inclusive. Example 1: Input: 3 Out...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Given a positive integer n, return a tuple that has the number of even and odd integer palindromes that fall within the range(1, n), inclusive. Example 1: Input: 3 Output: (1, 2) ...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Write a function countNums which takes an array of integers and returns the number of elements which has a sum of digits > 0. If a number is negative, then its first signed digit will b...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Write a function countNums which takes an array of integers and returns the number of elements which has a sum of digits > 0. If a number is negative, then its first signed digit will be negative: ...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The numbers in the array will be randomly ordered. Your task is to determine if it is possible to get an array sorted in...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The numbers in the array will be randomly ordered. Your task is to determine if it is possible to get an array sorted in non-decreasin...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** In this problem, you will implement a function that takes two lists of numbers, and determines whether it is possible to perform an exchange of elements between them to make lst1 a list...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** In this problem, you will implement a function that takes two lists of numbers, and determines whether it is possible to perform an exchange of elements between them to make lst1 a list of only even ...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Given a string representing a space separated lowercase letters, return a dictionary of the letter with the most repetition and containing the corresponding count. If several letters ha...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Given a string representing a space separated lowercase letters, return a dictionary of the letter with the most repetition and containing the corresponding count. If several letters have the same oc...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Task We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c then check if the result string is palindrome. A string is ca...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Task We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c then check if the result string is palindrome. A string is called palindrom...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Given a list of strings, where each string consists of only digits, return a list. Each element i of the output should be "the number of odd elements in the string i of the input." wher...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Given a list of strings, where each string consists of only digits, return a list. Each element i of the output should be "the number of odd elements in the string i of the input." where all the i's ...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Given an array of integers nums, find the minimum sum of any non-empty sub-array of nums. Example minSubArraySum(Arrays.asList(2, 3, 4, 1, 2, 4)) == 1 minSubArraySum(Arrays.asLi...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Given an array of integers nums, find the minimum sum of any non-empty sub-array of nums. Example minSubArraySum(Arrays.asList(2, 3, 4, 1, 2, 4)) == 1 minSubArraySum(Arrays.asList(-1, -2, -3)...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** You are given a rectangular grid of wells. Each row represents a single well, and each 1 in a row represents a single unit of water. Each well has a corresponding bucket that can be use...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** You are given a rectangular grid of wells. Each row represents a single well, and each 1 in a row represents a single unit of water. Each well has a corresponding bucket that can be used to extract w...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** In this Kata, you have to sort an array of non-negative integers according to number of ones in their binary representation in ascending order. For similar number of ones, sort based on...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** In this Kata, you have to sort an array of non-negative integers according to number of ones in their binary representation in ascending order. For similar number of ones, sort based on decimal value...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Given a string s and a natural number n, you have been tasked to implement a function that returns a list of all words from string s that contain exactly n consonants, in order these wo...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Given a string s and a natural number n, you have been tasked to implement a function that returns a list of all words from string s that contain exactly n consonants, in order these words appear in ...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** You are given a word. Your task is to find the closest vowel that stands between two consonants from the right side of the word (case sensitive). Vowels in the beginning and ending doe...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** You are given a word. Your task is to find the closest vowel that stands between two consonants from the right side of the word (case sensitive). Vowels in the beginning and ending doesn't count. Re...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** You are given a list of two strings, both strings consist of open parentheses "(" or close parentheses ")" only. Your job is to check if it is possible to concatenate the two strings in...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** You are given a list of two strings, both strings consist of open parentheses "(" or close parentheses ")" only. Your job is to check if it is possible to concatenate the two strings in some orde...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Given an array arr of integers and a positive integer k, return a sorted list of length k with the maximum k numbers in arr. Example 1: Input: arr = [-3, -4, 5], k = 3 ...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Given an array arr of integers and a positive integer k, return a sorted list of length k with the maximum k numbers in arr. Example 1: Input: arr = [-3, -4, 5], k = 3 Output: [-4, ...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions. Examples solution(Arrays.asList(5, 8, 7, 1)) ==> 12 solution(Arrays.asList...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions. Examples solution(Arrays.asList(5, 8, 7, 1)) ==> 12 solution(Arrays.asList(3, 3, 3, 3, 3...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Given a non-empty array of integers arr and an integer k, return the sum of the elements with at most two digits from the first k elements of arr. Example: Input: arr = [111,2...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Given a non-empty array of integers arr and an integer k, return the sum of the elements with at most two digits from the first k elements of arr. Example: Input: arr = [111,21,3,4000,5,6,7...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Given a positive integer n, return a sorted list that has the odd numbers in collatz sequence. The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined as...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Given a positive integer n, return a sorted list that has the odd numbers in collatz sequence. The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined as follows: star...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** You have to write a function which validates a given date string and returns true if the date is valid otherwise false. The date is valid if all of the following rules are satisfied: ...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** You have to write a function which validates a given date string and returns true if the date is valid otherwise false. The date is valid if all of the following rules are satisfied: 1. The date ...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Given a string of words, return a list of words split on whitespace, if no whitespaces exists in the text you should split on commas ',' if no commas exists you should return the number of ...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Given a string of words, return a list of words split on whitespace, if no whitespaces exists in the text you should split on commas ',' if no commas exists you should return the number of lower-case let...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Given a list of numbers, return whether or not they are sorted in ascending order. If list has more than 1 duplicate of the same number, return false. Assume no negative numbers and onl...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Given a list of numbers, return whether or not they are sorted in ascending order. If list has more than 1 duplicate of the same number, return false. Assume no negative numbers and only integers. ...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** You are given two intervals, where each interval is a pair of integers. For example, interval = (start, end) = (1, 2). The given intervals are closed which means that the interval (star...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** You are given two intervals, where each interval is a pair of integers. For example, interval = (start, end) = (1, 2). The given intervals are closed which means that the interval (start, end) in...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** You are given an array arr of integers and you need to return sum of magnitudes of integers multiplied by product of all signs of each number in the array, represented by 1, -1 or 0. ...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** You are given an array arr of integers and you need to return sum of magnitudes of integers multiplied by product of all signs of each number in the array, represented by 1, -1 or 0. Note: return...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Given a grid with N rows and N columns (N >= 2) and a positive integer k, each cell of the grid contains a value. Every integer in the range [1, N * N] inclusive appears exactly once on...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Given a grid with N rows and N columns (N >= 2) and a positive integer k, each cell of the grid contains a value. Every integer in the range [1, N * N] inclusive appears exactly once on the cells of ...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in the last couple centuries. However, what people don't know is Tribonacci sequence. Tribonacci sequence is d...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in the last couple centuries. However, what people don't know is Tribonacci sequence. Tribonacci sequence is defined by the ...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Given a positive integer n, return the product of the odd digits. Return 0 if all digits are even. For example: digits(1) == 1 digits(4) == 0 digits(235) == 15 */ ...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Given a positive integer n, return the product of the odd digits. Return 0 if all digits are even. For example: digits(1) == 1 digits(4) == 0 digits(235) == 15 */ public int di...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Create a function that takes a string as input which contains only square brackets. The function should return true if and only if there is a valid subsequence of brackets where at leas...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Create a function that takes a string as input which contains only square brackets. The function should return true if and only if there is a valid subsequence of brackets where at least one bracket ...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** You are given a list of numbers. You need to return the sum of squared numbers in the given list, round each element in the list to the upper int(Ceiling) first. Examples: For l...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** You are given a list of numbers. You need to return the sum of squared numbers in the given list, round each element in the list to the upper int(Ceiling) first. Examples: For lst = [1,2,3] t...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Create a function that returns true if the last character of a given string is an alphabetical character and is not a part of a word, and false otherwise. Note: "word" is a group of...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Create a function that returns true if the last character of a given string is an alphabetical character and is not a part of a word, and false otherwise. Note: "word" is a group of characters se...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Create a function which returns the largest index of an element which is not greater than or equal to the element immediately preceding it. If no such element exists then return -1. The...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Create a function which returns the largest index of an element which is not greater than or equal to the element immediately preceding it. If no such element exists then return -1. The given array w...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Create a function that returns a tuple (a, b), where 'a' is the largest of negative integers, and 'b' is the smallest of positive integers in a list. If there is no negative or posi...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Create a function that returns a tuple (a, b), where 'a' is the largest of negative integers, and 'b' is the smallest of positive integers in a list. If there is no negative or positive integers,...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Create a function that takes integers, floats, or strings representing real numbers, and returns the larger variable in its given variable type. Return None if the values are equal. ...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Create a function that takes integers, floats, or strings representing real numbers, and returns the larger variable in its given variable type. Return None if the values are equal. Note: If a re...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers Example isEqualToSumEven(4) == false isEqualToSumEven(6) == false isEqualToSumEv...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers Example isEqualToSumEven(4) == false isEqualToSumEven(6) == false isEqualToSumEven(8) == true ...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** The Brazilian factorial is defined as: brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1! where n > 0 For example: >>> specialFactorial(4) 288 The function will ...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** The Brazilian factorial is defined as: brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1! where n > 0 For example: >>> specialFactorial(4) 288 The function will receive an int...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Given a string text, replace all spaces in it with underscores, and if a string has more than 2 consecutive spaces, then replace all consecutive spaces with - fixSpaces("Example") ...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Given a string text, replace all spaces in it with underscores, and if a string has more than 2 consecutive spaces, then replace all consecutive spaces with - fixSpaces("Example") == "Example" ...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Create a function which takes a string representing a file's name, and returns "Yes" if the the file's name is valid, and returns "No" otherwise. A file's name is considered to be valid...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Create a function which takes a string representing a file's name, and returns "Yes" if the the file's name is valid, and returns "No" otherwise. A file's name is considered to be valid if and only i...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** This function will take a list of integers. For all entries in the list, the function shall square the integer entry if its index is a multiple of 3 and will cube the integer entry if its i...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** This function will take a list of integers. For all entries in the list, the function shall square the integer entry if its index is a multiple of 3 and will cube the integer entry if its index is a mult...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose le...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Your task is to implement a function that will simplify the expression x * n. The function returns true if x * n evaluates to a whole number and false otherwise. Both x and n, are strin...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Your task is to implement a function that will simplify the expression x * n. The function returns true if x * n evaluates to a whole number and false otherwise. Both x and n, are string representati...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, o...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them base...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Write a function that takes an array of numbers as input and returns the number of elements in the array that are greater than 10 and both first and last digits of a number are odd (1, ...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Write a function that takes an array of numbers as input and returns the number of elements in the array that are greater than 10 and both first and last digits of a number are odd (1, 3, 5, 7, 9). ...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** You are given a positive integer n. You have to create an integer array a of length n. For each i (1 <= i <= n), the value of a[i] = i * i - i + 1. Return the number of triples ...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** You are given a positive integer n. You have to create an integer array a of length n. For each i (1 <= i <= n), the value of a[i] = i * i - i + 1. Return the number of triples (a[i], a[j], a...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** There are eight planets in our solar system: the closerst to the Sun is Mercury, the next one is Venus, then Earth, Mars, Jupiter, Saturn, Uranus, Neptune. Write a function that tak...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** There are eight planets in our solar system: the closerst to the Sun is Mercury, the next one is Venus, then Earth, Mars, Jupiter, Saturn, Uranus, Neptune. Write a function that takes two planet ...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Write a function that accepts a list of strings as a parameter, deletes the strings that have odd lengths from it, and returns the resulted list with a sorted order, The list is alw...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Write a function that accepts a list of strings as a parameter, deletes the strings that have odd lengths from it, and returns the resulted list with a sorted order, The list is always a list of ...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** A simple program which should return the value of x if n is a prime number and should return the value of y otherwise. Examples: for xOrY(7, 34, 12) == 34 for xOrY(15, 8, 5) ==...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** A simple program which should return the value of x if n is a prime number and should return the value of y otherwise. Examples: for xOrY(7, 34, 12) == 34 for xOrY(15, 8, 5) == 5 */ ...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Given a list of numbers, return the sum of squares of the numbers in the list that are odd. Ignore numbers that are negative or not integers. doubleTheDifference(Arrays.asList(1, 3, 2,...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Given a list of numbers, return the sum of squares of the numbers in the list that are odd. Ignore numbers that are negative or not integers. doubleTheDifference(Arrays.asList(1, 3, 2, 0)) == 1 + 9 ...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** I think we all remember that feeling when the result of some long-awaited event is finally known. The feelings and thoughts you have at that moment are definitely worth noting down and ...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** I think we all remember that feeling when the result of some long-awaited event is finally known. The feelings and thoughts you have at that moment are definitely worth noting down and comparing. ...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** You will be given the name of a class (a string) and a list of extensions. The extensions are to be used to load additional classes to the class. The strength of the extension is as fol...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** You will be given the name of a class (a string) and a list of extensions. The extensions are to be used to load additional classes to the class. The strength of the extension is as follows: Let CAP ...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** You are given 2 words. You need to return true if the second word or any of its rotations is a substring in the first word cycpatternCheck("abcd","abd") => false cycpatternCheck("hello"...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** You are given 2 words. You need to return true if the second word or any of its rotations is a substring in the first word cycpatternCheck("abcd","abd") => false cycpatternCheck("hello","ell") => tru...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Given an integer. return a tuple that has the number of even and odd digits respectively. Example: evenOddCount(-12) ==> (1, 1) evenOddCount(123) ==> (1, 2) */ ...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Given an integer. return a tuple that has the number of even and odd digits respectively. Example: evenOddCount(-12) ==> (1, 1) evenOddCount(123) ==> (1, 2) */ public List<...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Given a positive integer, obtain its roman numeral equivalent as a string, and return it in lowercase. Restrictions: 1 <= num <= 1000 Examples: >>> intToMiniRoman(19) == "xix" ...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Given a positive integer, obtain its roman numeral equivalent as a string, and return it in lowercase. Restrictions: 1 <= num <= 1000 Examples: >>> intToMiniRoman(19) == "xix" >>> intToM...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Given the lengths of the three sides of a triangle. Return true if the three sides form a right-angled triangle, false otherwise. A right-angled triangle is a triangle in which one angl...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Given the lengths of the three sides of a triangle. Return true if the three sides form a right-angled triangle, false otherwise. A right-angled triangle is a triangle in which one angle is right ang...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Write a function that accepts a list of strings. The list contains different words. Return the word with maximum number of unique characters. If multiple strings have maximum number of ...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Write a function that accepts a list of strings. The list contains different words. Return the word with maximum number of unique characters. If multiple strings have maximum number of unique cha...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** You're a hungry rabbit, and you already have eaten a certain number of carrots, but now you need to eat more carrots to complete the day's meals. you should return an array of [ total n...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** You're a hungry rabbit, and you already have eaten a certain number of carrots, but now you need to eat more carrots to complete the day's meals. you should return an array of [ total number of eaten...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Given two lists operator, and operand. The first list has basic algebra operations, and the second list is a list of integers. Use the two given lists to build the algebric expression a...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Given two lists operator, and operand. The first list has basic algebra operations, and the second list is a list of integers. Use the two given lists to build the algebric expression and return the ...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string....
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The funct...
Of course, here is the Java code you requested: ```java import java.math.BigInteger; import java.security.*; import java.util.*; import java.lang.*; class Solution { /** Given a string "text", return its md5 hash equivalent string with length being 32. If "text" is an empty string, return Optional.empty()...
Create Java method to complete this class: import java.math.BigInteger; import java.security.*; import java.util.*; import java.lang.*; class Solution { /** Given a string "text", return its md5 hash equivalent string with length being 32. If "text" is an empty string, return Optional.empty(). >>>...
Of course, here is the Java code you requested: ```java import java.util.*; import java.lang.*; class Solution { /** Given two positive integers a and b, return the even digits between a and b, in ascending order. For example: generateIntegers(2, 8) => [2, 4, 6, 8] generateIntegers(8, 2) => [...
Create Java method to complete this class: import java.util.*; import java.lang.*; class Solution { /** Given two positive integers a and b, return the even digits between a and b, in ascending order. For example: generateIntegers(2, 8) => [2, 4, 6, 8] generateIntegers(8, 2) => [2, 4, 6, 8] ...