content stringlengths 263 5.24M | pred_label stringclasses 1
value | pred_score_pos float64 0.6 1 |
|---|---|---|
## concatalternate
### Instructions
Write a function `ConcatAlternate()` that receives two slices of an `int` as arguments and returns a new slice with the result of the alternated values of each slice.
- The input slices can be of different lengths.
- The new slice should start with an element of the largest slice.... | __label__POS | 0.9983 |
## Deep Equal
### Instructions
Write a function `deepEqual(obj1, obj2)` that checks whether two objects are **deeply equal**. Two objects are considered deeply equal if:
- They have the same structure and content.
- Their nested objects and arrays are also equal.
- Primitive values (numbers, strings, booleans) are s... | __label__POS | 0.863999 |
## diamond_creation
### Instructions
Build the **function** `make_diamond` which takes a letter as an input, and returns a diamond.
> Assume the input is always a valid uppercase letter.
Rules:
- The first and last row contain one 'A'.
- The given letter has to be at the widest point.
- All rows, except the first ... | __label__POS | 0.660762 |
## Pimp my style
### Instructions
Check out that button on the HTML page:
```html
<button class="button">pimp my style</div>
```
For now, it's only a lonely, basic and sad element. let's pimp it up.
On each click on the page, a function `pimp` is triggered.
Write the body of that function so that the button's clas... | __label__POS | 0.837363 |
## listsort
### Instructions
Write a function `ListSort` that sorts the nodes of a linked list by ascending order.
### Expected function and structure
```go
type NodeI struct {
Data int
Next *NodeI
}
func ListSort(l *NodeI) *NodeI {
}
```
> You will use **this** `NodeI` structure in subsequent exercises.
### ... | __label__POS | 0.843965 |
## veterinary
### Instructions
There is a new veterinary in town!
To help him get introduced to your neighborhood, create an object `veterinary` with the following properties:
- an array of string `animalKnowledge` that will store all the animal species the new veterinary can treat,
- a function `canTreat` that wil... | __label__POS | 0.961049 |
## Object Lab
### Instructions
Write a function `mergeAndTransform(objects, transforms)` that:
- Takes an array of objects `objects` and an array of transformation functions `transforms`.
- Merges all objects into a single object:
- If there are conflicting keys, the value from the later object in the array overwr... | __label__POS | 0.87656 |
## Find Pairs
### Instructions
Write a program that finds all pairs of elements in an integer array that sum up to a given target value. The program should output a list of pairs, each representing the indices of the elements that form the pair.
In this exercise you must take in consideration the following:
- Ensur... | __label__POS | 0.668467 |
## looping
### Instructions
Write a **program** that prints a riddle, receives input from the user and checks that the answer is correct.
The program must allow an indefinite number of trials and only quit after the correct answer is given.
Every time the user introduces an incorrect answer the program must print t... | __label__POS | 0.999749 |
## Bubble Sort Analyzer
### Instructions
Write a function `bubbleSortAnalyzer(arr, comparator)` that:
- Takes an array `arr` and a comparator function `comparator`.
- Sorts the array using the **bubble sort** algorithm and returns an object with the following properties:
- `sortedArray`: The sorted array.
- `ite... | __label__POS | 0.999122 |
#### Functional
###### Can you register a new user providing a `username`, an `email`, a `password` and a `password confirmation`?
###### Can you log in a user providing its `email` and `password`?
###### While not logged in, are there three buttons (`Login` button, `Leaderboard` button and `Start Quiz` button) in t... | __label__POS | 0.911482 |
## Transform Objects
> Mindful AI mode
### Context
Imagine your favorite robot friend with all its cool features: a type, weight, and operational status.
In JavaScript, we use objects to group these properties together, making it easy to manage and tweak our robot’s settings. Let’s see how we can modify, add, or re... | __label__POS | 0.682902 |
## First move
> Brainpower mode
### Context
Glad to see you here! It's impressive how far you've come today, and you are just one step away from seeing a simple yet impressive thing we can do with JavaScript. This will give you a glimpse of how JavaScript works with HTML and CSS to make your robot interesting! By us... | __label__POS | 0.731816 |
## Listed
> Mindful AI mode
### Context
Sometimes we don't need a key, we just want a list of things, JS has a special type for that, called an array.
In JavaScript, arrays are essential tools for handling these lists efficiently.
Let's discover them together!
### AI-Powered Learning Techniques
**Example-Based L... | __label__POS | 0.717525 |
## Good Recipe
> Mindful AI mode
### Context
Welcome to this quest! I bet you are hungry after this long way gaining power!
Are you ready to cook? But instead of cooking food, we'll be applying recipes to data through methods! In JavaScript, methods are special functions called from another value, allowing you to p... | __label__POS | 0.802353 |
## Colorful legs
> JSPowered Mode
### Context
Your robot is cool! But you can make it even more striking! Or at least, make it show off its colorful legs to everyone!
> Follow the instructions, ask your peers if you are stuck and stay motivated because you are close to the goal!
> Follow every hint you have in the ... | __label__POS | 0.630567 |
##### Open the repository of the project and check the submitted files
###### Can you confirm that the `crosswordSolver.js` file is present and you can run the following command `node crosswordSolver.js` adding the following lines to the original `crosswordSolver.js`?
```js
const puzzle = '2001\n0..0\n1000\n0..0'
con... | __label__POS | 0.735332 |
/*******************************
* functions given to the students
********************************/
const SIZE = 100
const MAP = new Int8Array(SIZE * SIZE)
const isFree = ({ x, y }) => MAP[y * SIZE + x] === 0
const isOccupied = ({ x, y }) => MAP[y * SIZE + x] === 1
const inBounds = (n) => n < SIZE && n >= 0
const is... | __label__POS | 0.760519 |
const SIZE = 100
const MAP = new Int8Array(SIZE * SIZE) // State of the Map
const isFree = ({ x, y }) => MAP[y * SIZE + x] === 0 // 0 = block free
const isOccupied = ({ x, y }) => MAP[y * SIZE + x] === 1 // 1 = block occupied
const inBounds = n => n < SIZE && n >= 0
const isInBounds = ({ x, y }) => inBounds(x) && inBou... | __label__POS | 0.906852 |
## lem-in-examples
- Create your file and copy the examples into it.
### example00
```
4
##start
0 0 3
2 2 5
3 4 0
##end
1 8 3
0-2
2-3
3-1
```
### example01
```
10
##start
start 1 6
0 4 8
o 6 8
n 6 6
e 8 4
t 1 9
E 5 9
a 8 9
m 8 6
h 4 6
A 5 2
c 8 1
k 11 2
##end
end 11 6
start-t
n-e
a-m
A-c
0-o
E-a
k-end
start-h
o-n... | __label__POS | 0.973702 |
#### General
##### Check the Repo Content
Files that must be inside the repository:
- Detailed documentation in the `README.md` file contains exploit reports and ethical hacking reports documenting the vulnerabilities found.
###### Are all the required files present?
##### Play the Role of a Stakeholder
Organize ... | __label__POS | 0.6775 |
#### General
##### Check the Repo Content
Files that must be present in the repository:
- Detailed documentation in the `README.md` file contains the walkthrough and vulnerability report email.
- Any scripts or files created or used during the project.
###### Are all the required files present?
##### Play the Role... | __label__POS | 0.620028 |
# Package
Package can be used to organize and share a set of functions in Dart. It is simply a sharable library or modules.
Package is similar to Dart Application except that Dart Package does not have application entry point - `main`.
A minimal package consists of the following:
- `pubspec.yaml`: a metadata file tha... | __label__POS | 0.761246 |
#### Functional
###### Does the app show a list of all fetched posts on the main screen?
###### When you tap on a post, does it open the content in a `WebView`?
###### Is it possible to go back to the main page from the `WebView`?
###### When you tap on the login button, does it open the login page?
##### Login wi... | __label__POS | 0.9206 |
#### Competitive Analyzes
###### Is there a zip folder labeled as “ProjectTitle_Name_FirstName”?
###### Are the deliverables labeled as Name_FirstName_DeliverableName_Date_VersionNumber”?
###### Are the deliverables in the correct format?
###### Are the documents clear, simple and easy to read?
###### Is there an ... | __label__POS | 0.870818 |
#### Interview Guide
###### Is the deliverable labeled as Name_FirstName_DeliverableName_Date_VersionNumber”?
###### Is the deliverable in the correct format (PDF)?
###### Is there a title within the document?
###### Is the document clear, simple and easy to read?
###### Is the main purpose of the interview writte... | __label__POS | 0.713613 |
**Guillemette, 31 years old, accountant freelance, French, lives in Nantes, France**
Run
- What sports do you practice?
- I swim and run.
- How often do you run?
- I swim once or twice a month.
- As to running, I haven't run in 9 months due to my pregnancy, but I normally run once a week.
- When was the last ti... | __label__POS | 0.902091 |
**Antoine, 29 years old, CEO in a renewable energy company French, lives in Lisbon, Portugal**
Run
- What sports do you practice?
- Regularly? Running mostly, I'm also trying to practice regularly tennis and kite surfing.
- From time to time, I practice sailing, skiing, and surfing as well. And that's pretty much... | __label__POS | 0.939337 |
**Joe, 30 years old, translator, British, lives in Lisbon, Portugal**
Run
- What sports do you practice?
- Not that many. But throughout my life, I've tried many things. I go surfing sometimes, swimming quite a lot and I've tried skateboarding lately.
- I run quite often though.
- How often do you run?
- On ave... | __label__POS | 0.846511 |
**Guillaume, 30 years old, sales manager, lives in Paris, France**
Run
- What sports do you practice?
- I've been practicing rugby for 10 years and I run several times a week. I got injured in 2012, followed with a bone graft which took me 3 years to recover.
- How often do you run?
- It depends. Last November I ... | __label__POS | 0.93011 |
**Anaëlle, 29 years old, consultant, French, lives in Paris, France**
Run
- What sports do you practice?
- Running and muscle building. I have had a coach for 4 months. I do a one-hour session with him per week, based on running. Sheathing, slits, pumps, mobility exercises, stretching.
- How often do you run?
- F... | __label__POS | 0.88555 |
**Nathan, 39 years old, entrepreneur in agriculture, from the US, lives in Lisbon, Portugal**
Run
- What sports do you practice?
- Running, sailing, kiteboarding. But sailing and kiteboarding are not very often. I haven't done any sailing or kiteboarding in over a year. In San Francisco it was different. I lived th... | __label__POS | 0.683468 |
**William, 33, accountant, French, lives in Paris, France**
Run
- What sports do you practice?
- I train for ultra trails. Ultra = over 50km, Trail = not on the road, in the mountains.
- My specialty is to run very long races, beyond 3 days, over 300 km. Usually, it's between 50 and 162 km. There are races everyw... | __label__POS | 0.710407 |
#### User interview
###### Is the deliverable labeled as “Name_FirstName_DeliverableName_Date_VersionNumber”?
###### Is the deliverable in the correct format (PDF)?
###### Is there a title within the document?
###### Is the document clear, simple and easy to read?
###### Are there at least 6 insights different fro... | __label__POS | 0.920784 |
#### Styleguide
###### Is the deliverable labeled as “Name_FirstName_DeliverableName_Date_VersionNumber”?
###### Is the deliverable in the correct format (Figma)?
###### Is there a title within the document?
###### Is the document clear, simple and easy to read?
###### Does the moodboard include pictures?
###### ... | __label__POS | 0.836559 |
#### Browsing
###### Is the deliverable labeled as “Name_FirstName_DeliverableName_Date_VersionNumber”?
###### Are the deliverables in the correct format (Figma)?
###### Is there a title within the document?
###### Is the document clear, simple and easy to read?
###### Are there 4 pages?
##### Check the pages 1, ... | __label__POS | 0.669373 |
#### quadA
> **_NOTE: If you are an admin and you want to test this project, follow the instructions [in the this subject](https://github.com/01-edu/go-tests/blob/master/raid-testing.md) before you proceed to the questions._**
##### Open the repository of the project and check the submitted files
###### Can you conf... | __label__POS | 1.000002 |
#### Functional
##### Using the ray tracer construct any scene you want, including at least one of all objects. (this can take a while to render, so in the meantime you can skip the first two questions and answer the following ones)
###### Does the image correspond to the scene you created?
###### Is it possible for... | __label__POS | 0.682138 |
## Semi Brute
Hash functions are used to secure information. A piece of data, for instance a password, is hashed and only its hash is stored. While there is no way to compute on the original information, one can try every possible value. This is called a brute force attack.
Proof of Work algorithms work in a similar ... | __label__POS | 0.990352 |
## Local Node Info
To get started, we will create a simple web page that displays basic information from our local node.
### Instructions
Create a web page called `localNodeInfo.html` that does the following:
1. Loads an Ethereum library, such as `ethers.js` or `web3.js`.
2. Connects to a local Ethereum node at `ht... | __label__POS | 0.887699 |
> Due to file size reason, the solution might be uploaded on GitHub instead of Gitea!
#### Functional
###### Are there at least three different car models?
###### When you walk close to a car door, does a message appear saying that to enter you need to press the 'E' key?
###### If you click 'E' next to the car door... | __label__POS | 0.669608 |
> Due to file size reason, the solution might be uploaded on GitHub instead of Gitea!
#### Functional
###### Can the Countess character move in the four directions (forward, backward, left and right) using the WASD keys?
###### Can the Countess character jump using the Space key?
###### Can the Countess character a... | __label__POS | 0.930282 |
## Steady Sequence
### Instructions
Create a class named `SteadySequence` that includes a method to determine the length of the longest consecutive sequence in an unsorted array of integers. The "longest consecutive sequence" refers to the sequence with the longest stretch of elements that increase strictly by 1. The... | __label__POS | 0.999584 |
## TodoList
### Instructions
Write a class `Task` that has two attributes: `description` and `status`, with the corresponding getters and setters.
Write a class called `TodoList` that represents a to-do list. The class should be able to hold a specified number of tasks, each with a description and a status. Include ... | __label__POS | 0.971216 |
## Circular Linked List
### Instructions
Create a circular single linked list data structure that implements the following methods:
- `at(int index)`: to access an element by its index. if the index is negative or if the list is empty return -1.
- `add(int value)`: to add an element at the end of the list.
- `remove... | __label__POS | 0.992191 |
## UnitConverter
### Instructions
In a file named `UnitConverter.java`, write a function `convert` that returns the result of a unit conversion specified in the parameters. The function should handle different types of unit conversions based on the input parameters which specify the unit from, the unit to, and the va... | __label__POS | 0.984185 |
## Distinct Substring length
### Instructions
Create a class named `DistinctSubstringLength` that provides a method to determine the length of the longest substring in a given string that contains no repeating characters.
Character comparison must be case-sensitive.
### Expected Class
```java
public class Distinct... | __label__POS | 1.000001 |
## Area Calculator
### Instructions
Create a class `AreaCalculator` that has an overloaded method `calculate` to calculate the area of different shapes. The method should be able to calculate the area for:
- A circle (given the radius)
- A rectangle (given the width and height)
- A triangle (given the base and heigh... | __label__POS | 0.954693 |
## Factorial Master
### Instructions
Create an abstract class `Factorial` that will serve as the base class for calculating the factorial of a number. This class should have an abstract method `calculate` that will be implemented by its child classes.
Implement two child classes:
- `IterativeFactorial` which implem... | __label__POS | 0.989653 |
## Harmonious Fusion
### Instructions
Create a class `HarmoniousFusion` that provides a method to merge two sorted arrays into one sorted array. The merged array should also be sorted.
### Expected Class
```java
public class HarmoniousFusion {
public int[] merge(int[] arr1, int[] arr2) {
// Implementati... | __label__POS | 0.99978 |
## Armstrong Number
### Instructions
Write a program to check if a given number is an Armstrong number. An Armstrong number of n digits is an integer such that the sum of its digits raised to the power n is equal to the number itself.
Example: 153 is an Armstrong number bacause `1^3 + 5^3 + 3^3 = 153`
### Expected ... | __label__POS | 0.999041 |
public class ExerciseRunner {
public static void main(String[] args) {
// Example of a very short project
ProjectTime shortProject = new ProjectTime("2023-05-14 09:00", "2023-05-14 09:30");
System.out.println("Short Project Total Logged Time: " + shortProject.getHoursLogged()); // Should be... | __label__POS | 0.986072 |
## TimeTracker
### Instructions
Write a `ProjectTime` class to track the duration of a project using start and end times. You will be asked to add getter and setter methods for the `startTime` and `endTime` attributes. When you set one of them, you must update the `hoursLogged` attribute. The `hoursLogged` getter sho... | __label__POS | 0.864955 |
## Flexisort
### Instructions
Create an abstract class `Sorter` that will be used as a base class for sorting algorithms. This class should have an abstract method `sort` that will be implemented by its child classes. Additionally, it should have methods to set and get the array to sort.
Implement two child classes:... | __label__POS | 0.942526 |
public class ExerciseRunner {
public static void main(String[] args) {
DayOfWeekFinder finder = new DayOfWeekFinder();
// Test case 1
String startDate1 = "2023-06-22";
String dayOfWeek1 = "Monday";
System.out.println("Next " + dayOfWeek1 + " after " + startDate1 + ": " + fin... | __label__POS | 0.881555 |
## Day Of Week
### Instructions
Create a class `DayOfWeekFinder` that provides a method to find the date of the next specified day of the week from a given date. The date will be provided in the format `yyyy-MM-dd`, and the day of the week will be provided as a string ("Sunday","Monday","Tuesday","Wednesday","Thursda... | __label__POS | 0.705686 |
## Top Frequents
### Instructions
Given a non-empty array of integers, return the `k` most frequent elements. Use a hash map together with a heap to ensure efficient lookup and retrieval.
The resulting array should be ordered primarily by frequency (most frequent first). In case of a frequency tie, the element that ... | __label__POS | 0.999123 |
## Breakdown URL
### Instructions
Create a class `BreakdownURL` with a method that uses a regular expression to parse a URL and return its components.
**Requirements**
- Extract the following components when present: `protocol`, `domain`, `port`, `path`, `query`.
- Assume the input URL is valid (well-formed).
- Ret... | __label__POS | 0.828248 |
## Longest Common Prefix
### Instructions
Write a function to find the longest common prefix string amongst an array of strings, with case-sensitive comparison. If there is no common prefix, return an empty string "".
### Expected Class
```java
public class LongestCommonPrefix {
public String findLongestCommonP... | __label__POS | 0.999996 |
## Date Formatter
### Instructions
Write a class `DateFormatter` that has three private attributes:
- `date`: the date to be formatted (as a UNIX time in seconds).
- `format`: the format to convert the date to.
- `formattedDate`: contains the date converted into the given format(in the "UTC" Timezone).
Create gette... | __label__POS | 0.883815 |
## Factory Blueprint
### Instructions
You are given an incomplete Factory design pattern implementation with some incorrect parts. Complete and fix the class to demonstrate your understanding of how the Factory design pattern works.
### Expected Classes
```java
// Product interface
public interface Product {
vo... | __label__POS | 0.973019 |
## First Unique
### Instructions
Write a function that finds the first non-repeating character in a string. If there is no such character, return an underscore (\_).
### Expected Class
```java
public class FirstUnique {
public char findFirstUnique(String s) {
// Implementation to find the first non-repe... | __label__POS | 0.999958 |
## Perfect Number
### Instructions
Write a program to check if a given number is a perfect number. A perfect number is a positive integer that is equal to the sum of its proper positive divisors, excluding itself.
### Expected Class
```java
public class PerfectNumber {
public boolean isPerfectNumber(int number)... | __label__POS | 0.999882 |
## Check Anagram
### Instructions
Create a class `AnagramChecker` that provides a method to check if two strings are anagrams. An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.The comparison should be case insensitive... | __label__POS | 0.999357 |
## Maximal Square
### Instructions
Create a class `MaximalSquare` that provides a method to find the area of the largest square containing only 1's in a given 2D binary matrix.
### Expected Class
```java
public class MaximalSquare {
public int maximalSquare(char[][] matrix) {
// Implementation to find t... | __label__POS | 0.999815 |
public class ExerciseRunner {
public static void main(String[] args) {
HTMLValidator validator = new HTMLValidator();
// Test case 1: Valid HTML
String html1 = "<html><body><h1>Hello, World!</h1></body></html>";
System.out.println("Is HTML valid? " + validator.validateHTML(html1)); ... | __label__POS | 0.996893 |
## HTML Validator
### Instructions
Create a class `HTMLValidator` that provides a method to validate whether a given HTML string is correctly formatted. The method should support a few basic HTML tags (`<html>`, `<body>`, `<div>`, `<p>`, `<b>`, `<i>`, `<h1>`, `<h2>`). If the HTML is valid, the method should return `t... | __label__POS | 0.999456 |
import java.util.List;
import java.util.Arrays;
public class ExerciseRunner {
public static void main(String[] args) {
ConfigProtector protector = new ConfigProtector();
// Test case 1
String configFile1 = "username=admin\npassword=secret\nhost=localhost\n";
List<String> sensitiveK... | __label__POS | 0.998557 |
public class ExerciseRunner {
public static void main(String[] args) {
ValidSudoku validSudoku = new ValidSudoku();
// Test case 1
char[][] board1 = {
{'5', '3', '.', '.', '7', '.', '.', '.', '.'},
{'6', '.', '.', '1', '9', '5', '.', '.', '.'},
{'.', '9',... | __label__POS | 0.999991 |
## Valid Sudoku
### Instructions
Determine if a 9x9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules:
1. Each row must contain the digits 1-9 without repetition.
2. Each column must contain the digits 1-9 without repetition.
3. Each of the nine 3x3 sub-boxes of the g... | __label__POS | 0.9998 |
## Age Finder
### Instructions
Create a class `AgeFinder` that provides a method to calculate the age from a given date. The date will be provided in the format `yyyy-MM-dd`.
In case of any error the method `calculateAge` should return `-1`
> 💡 Have you ever seen someone with a negative age???
### Expected Class
... | __label__POS | 0.983598 |
## Builder Blueprint
### Instructions
You are given an incomplete Builder design pattern implementation with some incorrect parts. Complete and fix the classes to demonstrate your understanding of how the Builder design pattern works.
Regex component required:
- Any Character: `.`
- Digit: `\d`
- Whitespace : `\s`
... | __label__POS | 0.8992 |
## Spiral Matrix
### Instructions
Create a class `SpiralMatrix` that provides a method to generate a matrix filled with elements from 1 to n\*n in spiral order, given an integer n where n > 0.
### Expected Class
```java
public class SpiralMatrix {
public int[][] generateMatrix(int n) {
// Implementation... | __label__POS | 0.996459 |
public class ExerciseRunner {
public static void main(String[] args) {
LinkedList list = new DoubleLinkedList();
// Add elements to the list
list.add(1);
list.add(2);
list.add(3);
// Access elements by index
System.out.println("Element at index 0: " + list.a... | __label__POS | 0.995587 |
## Double Linked List
### Instructions
Create a double linked list data structure that implements the following methods:
- `at(int index)`: to access an element by its index. If the index is out of bound return -1.
- `add(int value)`: to add an element at the end of the list.
- `remove(int index)`: to remove an elem... | __label__POS | 0.984189 |
public class ExerciseRunner {
public static void main(String[] args) {
MonthlyPeriod MonthlyPeriod = new MonthlyPeriod();
String startDate1 = "2020-01-01";
String endDate1 = "2023-06-15";
System.out.println("Period: " + MonthlyPeriod.calculatePeriod(startDate1, endDate1));
... | __label__POS | 0.999816 |
## Monthly Period
### Instructions
Create a class `MonthlyPeriod` that provides a method to calculate the period between two given dates in terms of months and years. The dates will be provided in the format `yyyy-MM-dd`.
In case of any error the method `calculatePeriod` should return `Error`
> 💡 Going to the past... | __label__POS | 0.985909 |
## Single Linked List
### Instructions
Create a single linked list data structure that implements the following methods:
- `at(int index)`: to access an element by its index, if the index is out of bound return -1.
- `add(int value)`: to add an element at the end of the list.
- `remove(int index)`: to remove an elem... | __label__POS | 0.996104 |
## FormatDate
### Instructions
Create a file `FormatDate.java`.
Write a function `formatToFullText` that returns a formatted string using the date as parameter. The awaited format is `Le 22 août de l'an 2021 à 13h25m et 46s`
Write a function `formatSimple` that returns a formatted string using the date as parame... | __label__POS | 0.998038 |
## ParseDate
### Instructions
Create a file `ParseDate.java`.
Write a function `parseIsoFormat` that returns a date object using the string as parameter. The date as a parameter is in ISO format (`2022-04-25T20:51:28.709039322`)
Write a function `parseFullTextFormat` that returns a date object using the string as pa... | __label__POS | 0.996235 |
## DifferenceBetweenDate
### Instructions
Create a file `DifferenceBetweenDate.java`.
Write a function `durationBetweenTime` that returns the duration between the times as parameter. Must always be positive.
Write a function `periodBetweenDate` that returns the period between the dates as parameter.Must always be ... | __label__POS | 0.994405 |
## Cat
### Instructions
Create a file named `Cat.java`.
Write a function `cat` that reads the content of the file given as the argument, and writes it's content to the standard output.
> ⚠️ The files can have some binary content.
> 💡 Be aware of how much you read at once.
### Expected Functions
```java
import j... | __label__POS | 0.999307 |
## MapContains
You have been assigned the task of implementing a product inventory using Java maps. Each product has a unique ID as the key and the corresponding product details as the value.
### Instructions
Create a file `MapInventory.java`.
Write two functions:
Write a function `getProductPrice` that takes in p... | __label__POS | 0.999992 |
## Strategy
### Instructions
Now let's implement the Visitor Design Pattern
```mermaid
classDiagram
class Context {
-OperationStrategy operationStrategy
+Context()
+changeStrategy(OperationStrategy operationStrategy)
+execute(int a, int b) int
}
class OperationStrategy {
+execute(int a, int b... | __label__POS | 0.993788 |
## KeepTheChange
### Instructions
Create a file `KeepTheChange.java`.
Write a function `computeChange` that returns the list of coins that compose the change.
As parameters, we have :
* The amount to decompose into different coins
* The set of existing coins
The awaited solution is the best solution, so must hav... | __label__POS | 0.999735 |
## SortList
### Instructions
Create a file `SortList.java`.
Write a function `sort` that returns the ascending sorted list as parameter.
Write a function `sortReverse` that returns the descending sorted list as parameter.
### Expected Functions
```java
import java.util.List;
public class SortList {
publ... | __label__POS | 0.9999 |
## DoOp
### Instructions
Create a file named `DoOp.java`.
Write a function `operate` that returns the result of the given arithmetic operation specified in the parameters. The arguments should be passed in the following order:
- The first argument is the left operand
- The second argument is the operation sign
- The... | __label__POS | 0.999491 |
## StreamMap
### Instructions
Create a file `StreamMap.java`.
Create a function `sumOfStringLength` which returns the sum of the length of the strings in the stream.
Create a function `upperCaseAllString` which returns the list of all the strings in upper case.
Create a function `uniqIntValuesGreaterThan42` whic... | __label__POS | 0.999901 |
## RegexMatch
### Instructions
Create a file `RegexMatch.java`.
Write a function `containsOnlyAlpha` that returns `true` if the string as parameter contains only alpha characters.
Write a function `startWithLetterAndEndWithNumber` that returns `true` if the string as parameter starts with one letter and ends with ... | __label__POS | 1.000002 |
## Palindrome
### Instructions
Create a file `Palindrome.java`.
Write a function `isPalindrome` that returns true if the String in parameter is a palindrome, i.e. Have same spelling backwards and forwards (e.g. 'kayak').
### Expected Functions
```java
public class Palindrome {
public static boolean isPalindrom... | __label__POS | 0.999996 |
## SetOperations
### Instructions
Create a file `SetOperations.java`.
Write two functions:
Write a function `union` that takes two sets of integers as parameters and returns a new set that contains all the distinct elements from both sets.
Write a function `intersection` that Takes two sets of integers as paramete... | __label__POS | 0.999966 |
## ComputeArray
### Instructions
Create a file `ComputeArray.java`.
Write a function `computeArray` that receives an integer array, and returns a new array with computed values.
- If the item is a multiple of 3, it is multiplied by 5
- If the item is a multiple of 3 + 1 (e.g. 1, 4, 7, ...), it is incremented by 7
-... | __label__POS | 0.999914 |
## StarUtils
### Instructions
Now, let's add some useful methods to our class.
First, `toString` method which returns a literal version of our class. The format is the following : `<name> is positioned at (<x>, <y>, <z>)`. The printed double will have a precision of 3 decimals.
Then, `equals(Object object)` method ... | __label__POS | 0.778138 |
## FileManager
### Instructions
Create a file `FileManager.java`.
Write a function `createFile` that creates a file with the name and the content as parameter.
Write a function `getContentFile` that returns the content of the file as parameter.
Write a function `deleteFile` that deletes the file as parameter.
###... | __label__POS | 1.000007 |
## StringReplace
### Instructions
Create a file `StringReplace.java`.
Write a function called `StringReplace` that takes in three parameters: `original_string s`, `target`, and `replacement`. The function should replace all occurrences of target in `original_string s` with `replacement` and return the modified strin... | __label__POS | 0.999527 |
## AdventurException
### Instructions
Create a new class `DeadCharacterException` in a new file `DeadCharacterException.java`.
This class is an exception so should inherit from `Exception`.
This class has a constructor which takes a `Character` as parameter.
It has one method `getMessage` which returns a String :... | __label__POS | 0.793892 |
## Builder
### Instructions
Now let's implement the Builder Design Pattern
```mermaid
classDiagram
class Housing {
<<interface>>
+setSize(int size)*
+setPrice(int price)*
+setRooms(int rooms)*
+setName(String name)*
}
class House {
+setSize(int size)
+setPrice(int price)
+setRooms(int... | __label__POS | 0.91056 |
## StarStatic
### Instructions
Let's add some computation.
Our objective is to compute the distance between celestial objects. As you may have guessed, the values x, y and z are the coordinates of the object. Their unit is AU (Astronomical Unit) which is 150 000 000 km.
We will add two `static` and `public` methods... | __label__POS | 0.949084 |
## StreamReduce
### Instructions
Create a file `StreamReduce.java`.
Create a function `sumAll` which returns the sum of integers in the stream.
Create a function `divideAndAddElements` which sums the result of the division, of all the integers in the stream, by the divider.
### Expected Functions
```java
publi... | __label__POS | 0.999913 |
## StringContains
### Instructions
Create a file `StringContains.java`.
Write a function `isStringContainedIn` that returns true if the string `subString` is contained `s` string.
### Expected Functions
```java
public class StringContains {
public static boolean isStringContainedIn(String subString, String s) ... | __label__POS | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.