content stringlengths 263 5.24M | pred_label stringclasses 1
value | pred_score_pos float64 0.6 1 |
|---|---|---|
"""
by_length(xs::Vector{Int})::Vector{String}
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", "Five", "Six", "Seven",
"Eight", "Nine".
If the array is empty, re... | __label__POS | 0.995663 |
"""
unique_digits(xs::Vector{Int})::Vector{Int}
Given a list of positive integers `xs`. Return a sorted list of all
elements that hasn't any even digit.
!!! note
Returned list should be sorted in increasing order.
# Examples
```jldoctest
julia> unique_digits([15, 33, 1422, 1])
3-element Vector{Int64}:
1
... | __label__POS | 0.999685 |
"""
numerical_letter_grade(grades::Vector{Float64})::Vector{String}
It is the last week of the semester and the teacher has to give the grades to
students. The teacher has been making her own algorithm for grading. The only
problem is, she has lost the code she used for grading. She has given you a list
of GPAs fo... | __label__POS | 0.77704 |
"""
sorted_list_sum(xs::Vector{String})::Vector{String}
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 strings and never an array of numbers, and it may
contain dupli... | __label__POS | 0.997725 |
"""
exchange(lst1::Vector{Int}, lst2::Vector{Int})::String
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 numbers. There is no limit on the number
of exchanged ele... | __label__POS | 0.978161 |
"""
hex_key(num::String)::Int
You have been tasked to write a function that receives a hexadecimal number as a
string and counts the number of hexadecimal digits that are primes (prime
number, or a prime, is a natural number greater than 1 that is not a product of
two smaller natural numbers). Hexadecimal digits a... | __label__POS | 0.998379 |
"""
strongest_extension(class_name::String, extensions::Vector{String})::String
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 be the number of the uppercase lette... | __label__POS | 0.663243 |
"""
do_algebra(operator::Vector{String}, operand::Vector{Int})
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 evaluation of this expression.
The basic algebra ope... | __label__POS | 0.97587 |
"""
compare_one(a::Union{Integer, AbstractFloat, AbstractString}, b::Union{Integer, AbstractFloat, AbstractString})::Union{Integer, AbstractFloat, AbstractString, Nothing}
Create a function that takes integers, floats, or strings representing real
numbers, and returns the larger variable in its given variable type... | __label__POS | 0.964431 |
"""
simplify(x::String, n::String)::Bool
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 representation of a fraction, and have the
following format, <numerator>/<denominator> ... | __label__POS | 0.971698 |
"""
sort_array_based_on_head_tail(xs::Int)::Vector{Int}
Given an array of non-negative integers, return a copy of the given array after
sorting, you will sort the given array in ascending order if the sum( first
index value, last index value) is odd, or sort it in descending order if the
sum( first index value, la... | __label__POS | 0.999499 |
"""
find_max(words::Vector{String})::String
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 characters, return the one which comes
first in lexicographical order.
# Examp... | __label__POS | 0.999998 |
"""
get_row(xs::Vector{Vector{Int}}, x::Int)::Vector{Tuple{Int, Int}}
You are given a 2 dimensional data, as a nested lists, which is similar to
matrix, however, unlike matrices, each row may contain a different number of
columns. Given `xs`, and integer `x`, find integers `x` in the list `xs`, and
return list of ... | __label__POS | 0.994286 |
"""
compare(game::Vector{Int}, guess::Vector{Int})::Vector{Int}
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. Your task is to determine if a
person correctly guessed... | __label__POS | 0.913083 |
"""
histogram(s::String)::Dict{String, Int}
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 occurrence, return all of
them.
# Examples
```jldoctest
julia> histogram... | __label__POS | 0.999689 |
"""
odd_count(xs::Vector{String})::Vector{String}
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 should be replaced by the number
of odd digits in the i"th strin... | __label__POS | 0.996464 |
"""
match_parens(lst::Vector{String})::String
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 order, that the resulting string will be
good. A string S is considered to be ... | __label__POS | 0.965159 |
"""
file_name_check(file_name::String)::String
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 if all the following conditions are met:
- There should not be more tha... | __label__POS | 0.96021 |
"""
even_odd_palindrome(n::Int)::Tuple{Int, Int}
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.
!!! note
1. 1 <= n <= 10^3
2. returned tuple has the number of even and odd integer palindromes respectively.
... | __label__POS | 0.999082 |
"""
intersection(interval1::Vector{Int}, interval2::Vector{Int})::String
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) includes both start and end. For each given
inter... | __label__POS | 0.999958 |
"""
min_path(grid::Vector{Vector{Int}}, k::Int)::Vector{Int}
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 the grid.
You have to find the minimum path ... | __label__POS | 0.999763 |
"""
add_elements(xs::Vector{Int}, k::Int)::Int
Given a non-empty array of integers `xs` and an integer `k`, return the sum of
the elements with at most two digits from the first k elements of `xs`.
Constraints:
1. 1 <= length(xs) <= 100
2. 1 <= k <= length(xs)
# Examples
```jldoctest
julia> add_elements([111... | __label__POS | 0.999834 |
"""
fruit_distribution(s::String, n::Int)::Int
In this task, you will be given a string that represents a number of apples and
oranges that are distributed in a basket of fruit this basket contains apples,
oranges, and mango fruits. Given the string that represents the total number of
the oranges and apples and an... | __label__POS | 0.960717 |
"""
search(numbers::Vector)::Int
You are given a non-empty list of positive integers. Return the greatest integer
that is greater than zero, and has a frequency greater than or equal to the
value of the integer itself. The frequency of an integer is the number of times
it appears in the list. If no such a value ex... | __label__POS | 0.99962 |
"""
int_to_mini_roman(number::Int)::String
Given a positive integer, obtain its roman numeral equivalent as a string, and
return it in lowercase.
Restrictions: 1 <= num <= 1000
# Examples
```jldoctest
julia> int_to_mini_roman(19)
"xix"
julia> int_to_mini_roman(152)
"clii"
julia> int_to_mini_roman(426)
"cdxxvi... | __label__POS | 0.992219 |
"""
starts_one_ends(n::Int)::Int
Given a positive integer `n`, return the count of the numbers of n-digit
positive integers that start or end with 1.
"""
function starts_one_ends(n::Int)::Int
# Check if n is a positive integer
if n <= 0
error("Input must be a positive integer")
end
# Calc... | __label__POS | 0.993663 |
"""
will_it_fly(q::Vector{Int}, w::Int)::Bool
Write a function that returns `true` if the object `q` will fly, and `false`
otherwise. The object `q` will fly if it's balanced (it is a palindromic list)
and the sum of its elements is less than or equal the maximum possible weight
`w`.
# Examples
```jldoctest
juli... | __label__POS | 0.999997 |
"""
pluck(xs::Vector{Int})::Vector{Int}
Given an array representing a branch of a tree that has non-negative integer
nodes your task is to pluck one of the nodes and return it. The plucked node
should be the node with the smallest even value. If multiple nodes with the same
smallest even value are found return the... | __label__POS | 0.986247 |
"""
anti_shuffle(s::String)::String
Write a function that takes a string and returns an ordered version of it.
Ordered version of string, is a string where all words (separated by space) are
replaced by a new word where all the characters arranged in ascending order
based on ascii value.
Note: You should keep the... | __label__POS | 0.995486 |
"""
get_odd_collatz(n::Int)::Vector{BigInt}
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: start with any positive integer n. Then each term is
obtained from the pre... | __label__POS | 0.999139 |
"""
valid_date(date::String)::Bool
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 string is not empty.
2. The number of days is not less than 1 or higher than 31... | __label__POS | 0.914739 |
"""
bf(planet1::String, planet2::String)::NTuple
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 names as strings `planet1` and `planet2`. The
function should return a ... | __label__POS | 0.903835 |
"""
smallest_change(xs::Vector{Int})::Int
Given an array arr of integers, find the minimum number of elements that need to
be changed to make the array palindromic. A palindromic array is an array that
is read the same backwards and forwards. In one change, you can change one
element to any other element.
# Examp... | __label__POS | 1.000003 |
"""
encode_swap(message::String)::String
Write a function that takes a message, and encodes in such a way that it swaps
case of all letters, replaces all vowels in the message with the letter that
appears 2 places after that vowel in the english alphabet. Assume only
letters.
# Examples
```jldoctest
julia> encod... | __label__POS | 0.996498 |
"""
palindrome_with_append(s::String)::String
Find the shortest palindrome that begins with a supplied string. Algorithm idea
is simple:
- Find the longest postfix of supplied string that is a palindrome.
- Append to the end of the string reverse of a string prefix that comes before
the palindromic suffix... | __label__POS | 0.998892 |
"""
skjkasdkd(xs::Vector{Int})::Int
You are given a list of integers. You need to find the largest prime value and
return the sum of its digits.
# Examples
```jldoctest
julia> skjkasdkd([0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3])
10
julia> skjkasdkd([1, 0, 1, 8, 2, 4597, 2, 1, 3, ... | __label__POS | 0.999694 |
"""
select_words(s::String, n::Int)::Vector{<:AbstractString}
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 the string `s`. If the string `s`
is empty the... | __label__POS | 0.999822 |
"""
same_chars(s0::String, s1::String)::Bool
Check if two words have the same characters.
# Examples
```jldoctest
julia> same_chars("eabcdzzzz", "dddzzzzzzzddeddabc")
true
julia> same_chars("abcd", "dddddddabc")
true
julia> same_chars("dddddddabc", "abcd")
true
julia> same_chars("eabcd", "dddddddabc")
false
... | __label__POS | 0.996365 |
"""
largest_smallest_integers(xs::Vector{Int})::Tuple{Union{Nothing, Int}, Union{Nothing,Int}}
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, return them as `nothing`... | __label__POS | 0.962218 |
"""
total_match(xs::Vector{String}, ys::Vector{String})::Vector{String}
Write a function that accepts two lists of strings and returns the list that has
total number of chars in the all strings of the list less than the other list.
If the two lists have the same number of chars, return the first list.
# Examples... | __label__POS | 0.99814 |
"""
separate_paren_groups(paren_string::String)::Vector{String}
Input to this function is a string containing multiple groups of nested
parentheses. Your goal is to separate those group into separate strings and
return the list of those. Separate groups are balanced (each open brace is
properly closed) and not nes... | __label__POS | 0.958441 |
"""
reverse_delete(s::String, c::String)::Tuple{String, Bool}
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 palindrome if it reads the same backward as
forward. You should... | __label__POS | 0.999513 |
"""
move_one_ball(xs::Vector{Int})::Bool
We have an array `xs` of N integers xs[1], xs[2], ..., xs[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-decreasing order by performing the following
operation on the given array: You are allow... | __label__POS | 0.995599 |
"""
eat(number::Int, need::Int, remaining::Int)::Vector{Int}
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 carrots after your meals, the number
of carrots left a... | __label__POS | 0.993075 |
"""
Evaluates polynomial with coefficients `xs` at point `x`. Return `xs[1] + xs[2]
- x + xs[3] * x^2 + .... xs[n] * x^n`.
"""
poly(xs::Vector, x::Float64) = sum(coeff * (x^(i - 1)) for (i, coeff) in enumerate(xs))
"""
find_zero(xs::Vector{Int})
`xs` are coefficients of a polynomial. `find_zero` find `x` such... | __label__POS | 0.666754 |
"""
get_closest_vowel(word::String)::String
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. Return empty string if you
didn't find any vowel met the above condition.
... | __label__POS | 0.998261 |
"""
sorted_list_sum(xs::Vector{String})::Vector{String}
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 strings and never an array of numbers, and it may
contain dupli... | __label__POS | 0.996672 |
"""
exchange(lst1::Vector{Int}, lst2::Vector{Int})::String
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 numbers. There is no limit on the number
of exchanged ele... | __label__POS | 0.897822 |
"""
hex_key(num::String)::Int
You have been tasked to write a function that receives a hexadecimal number as a
string and counts the number of hexadecimal digits that are primes (prime
number, or a prime, is a natural number greater than 1 that is not a product of
two smaller natural numbers). Hexadecimal digits a... | __label__POS | 0.997937 |
"""
do_algebra(operator::Vector{String}, operand::Vector{Int})
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 evaluation of this expression.
The basic algebra ope... | __label__POS | 0.970065 |
"""
compare_one(a::Union{Integer, AbstractFloat, AbstractString}, b::Union{Integer, AbstractFloat, AbstractString})::Union{Integer, AbstractFloat, AbstractString, Nothing}
Create a function that takes integers, floats, or strings representing real
numbers, and returns the larger variable in its given variable type... | __label__POS | 0.925615 |
"""
simplify(x::String, n::String)::Bool
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 representation of a fraction, and have the
following format, <numerator>/<denominator> ... | __label__POS | 0.99478 |
"""
get_row(xs::Vector{Vector{Int}}, x::Int)::Vector{Tuple{Int, Int}}
You are given a 2 dimensional data, as a nested lists, which is similar to
matrix, however, unlike matrices, each row may contain a different number of
columns. Given `xs`, and integer `x`, find integers `x` in the list `xs`, and
return list of ... | __label__POS | 0.978292 |
"""
compare(game::Vector{Int}, guess::Vector{Int})::Vector{Int}
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. Your task is to determine if a
person correctly guessed... | __label__POS | 0.971205 |
"""
is_multiply_prime(a::Int)::Bool
Write a function that returns `true` if the given number is the multiplication
of 3 prime numbers and false otherwise. Knowing that `a` is less then 100.
# Examples
```jldoctest
julia> is_multiply_prime(30) # 30 = 2 * 3 * 5
true
```
"""
function is_multiply_prime(a::Int)::Bo... | __label__POS | 0.999382 |
"""
odd_count(xs::Vector{String})::Vector{String}
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 should be replaced by the number
of odd digits in the i"th strin... | __label__POS | 0.999425 |
"""
match_parens(lst::Vector{String})::String
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 order, that the resulting string will be
good. A string S is considered to be ... | __label__POS | 0.994835 |
"""
file_name_check(file_name::String)::String
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 if all the following conditions are met:
- There should not be more tha... | __label__POS | 0.892186 |
"""
even_odd_palindrome(n::Int)::Tuple{Int, Int}
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.
!!! note
1. 1 <= n <= 10^3
2. returned tuple has the number of even and odd integer palindromes respectively.
... | __label__POS | 0.997304 |
"""
intersection(interval1::Vector{Int}, interval2::Vector{Int})::String
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) includes both start and end. For each given
inter... | __label__POS | 0.999814 |
"""
min_path(grid::Vector{Vector{Int}}, k::Int)::Vector{Int}
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 the grid.
You have to find the minimum path ... | __label__POS | 0.999328 |
"""
fruit_distribution(s::String, n::Int)::Int
In this task, you will be given a string that represents a number of apples and
oranges that are distributed in a basket of fruit this basket contains apples,
oranges, and mango fruits. Given the string that represents the total number of
the oranges and apples and an... | __label__POS | 0.770482 |
"""
int_to_mini_roman(number::Int)::String
Given a positive integer, obtain its roman numeral equivalent as a string, and
return it in lowercase.
Restrictions: 1 <= num <= 1000
# Examples
```jldoctest
julia> int_to_mini_roman(19)
"xix"
julia> int_to_mini_roman(152)
"clii"
julia> int_to_mini_roman(426)
"cdxxvi... | __label__POS | 0.926342 |
"""
will_it_fly(q::Vector{Int}, w::Int)::Bool
Write a function that returns `true` if the object `q` will fly, and `false`
otherwise. The object `q` will fly if it's balanced (it is a palindromic list)
and the sum of its elements is less than or equal the maximum possible weight
`w`.
# Examples
```jldoctest
juli... | __label__POS | 0.999987 |
"""
max_fill(grid::Vector{Vector{Int}}, capacity::Int)::Int
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 water from it, and all buckets
have the same capacity. Yo... | __label__POS | 0.992552 |
"""
pluck(xs::Vector{Int})::Vector{Int}
Given an array representing a branch of a tree that has non-negative integer
nodes your task is to pluck one of the nodes and return it. The plucked node
should be the node with the smallest even value. If multiple nodes with the same
smallest even value are found return the... | __label__POS | 0.986423 |
"""
tri(n::Int)::Vector{Int}
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 recurrence:
tri(1) = 1
tri(n) = 1 + n / 2, if n is even.
tri(n) = tri(n - 1) + tri(... | __label__POS | 0.897032 |
"""
get_odd_collatz(n::Int)::Vector{BigInt}
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: start with any positive integer n. Then each term is
obtained from the pre... | __label__POS | 0.998036 |
"""
valid_date(date::String)::Bool
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 string is not empty.
2. The number of days is not less than 1 or higher than 31... | __label__POS | 0.826207 |
"""
bf(planet1::String, planet2::String)::NTuple
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 names as strings `planet1` and `planet2`. The
function should return a ... | __label__POS | 0.816698 |
"""
encode_swap(message::String)::String
Write a function that takes a message, and encodes in such a way that it swaps
case of all letters, replaces all vowels in the message with the letter that
appears 2 places after that vowel in the english alphabet. Assume only
letters.
# Examples
```jldoctest
julia> encod... | __label__POS | 0.919625 |
"""
skjkasdkd(xs::Vector{Int})::Int
You are given a list of integers. You need to find the largest prime value and
return the sum of its digits.
# Examples
```jldoctest
julia> skjkasdkd([0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3])
10
julia> skjkasdkd([1, 0, 1, 8, 2, 4597, 2, 1, 3, ... | __label__POS | 0.999427 |
"""
select_words(s::String, n::Int)::Vector{<:AbstractString}
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 the string `s`. If the string `s`
is empty the... | __label__POS | 0.999281 |
"""
largest_smallest_integers(xs::Vector{Int})::Tuple{Union{Nothing, Int}, Union{Nothing,Int}}
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, return them as `nothing`... | __label__POS | 0.9935 |
"""
total_match(xs::Vector{String}, ys::Vector{String})::Vector{String}
Write a function that accepts two lists of strings and returns the list that has
total number of chars in the all strings of the list less than the other list.
If the two lists have the same number of chars, return the first list.
# Examples... | __label__POS | 0.997839 |
"""
top_k(xs::Vector{Int}, k::Int)::Vector{Int}
Given an array `xs` of integers and a positive integer `k`, return a sorted list
of length `k` with the maximum `k` numbers in `xs` in the descending order.
!!! note
1. The length of the array will be in the range of [1, 1000].
2. The elements in the arra... | __label__POS | 0.998104 |
"""
parse_music(music_string::String)::Vector{Int}
Input to this function is a string representing musical notes in a special ASCII
format. Your task is to parse this string and return list of integers
corresponding to how many beats does each not last.
Here is a legend:
- `"o"` - whole note, lasts four beats
... | __label__POS | 0.857634 |
"""
count_up_to(n::Int)::Vector{Int}
Implement a function that takes an non-negative integer and returns an array of
the first n integers that are prime numbers and less than n.
# Example
```jldoctest
julia> count_up_to(5)
2-element Vector{Int64}:
2
3
julia> count_up_to(11)
4-element Vector{Int64}:
2
3
5
... | __label__POS | 0.999863 |
"""
move_one_ball(xs::Vector{Int})::Bool
We have an array `xs` of N integers xs[1], xs[2], ..., xs[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-decreasing order by performing the following
operation on the given array: You are allow... | __label__POS | 0.98927 |
"""
eat(number::Int, need::Int, remaining::Int)::Vector{Int}
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 carrots after your meals, the number
of carrots left a... | __label__POS | 0.976802 |
"""
by_length(xs::Vector{Int})::Vector{String}
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", "Five", "Six", "Seven",
"Eight", "Nine".
If the array is empty, re... | __label__POS | 0.998318 |
"""
numerical_letter_grade(grades::Vector{Float64})::Vector{String}
It is the last week of the semester and the teacher has to give the grades to
students. The teacher has been making her own algorithm for grading. The only
problem is, she has lost the code she used for grading. She has given you a list
of GPAs fo... | __label__POS | 0.691526 |
"""
sorted_list_sum(xs::Vector{String})::Vector{String}
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 strings and never an array of numbers, and it may
contain dupli... | __label__POS | 0.997692 |
"""
exchange(lst1::Vector{Int}, lst2::Vector{Int})::String
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 numbers. There is no limit on the number
of exchanged ele... | __label__POS | 0.904526 |
"""
hex_key(num::String)::Int
You have been tasked to write a function that receives a hexadecimal number as a
string and counts the number of hexadecimal digits that are primes (prime
number, or a prime, is a natural number greater than 1 that is not a product of
two smaller natural numbers). Hexadecimal digits a... | __label__POS | 0.986405 |
"""
do_algebra(operator::Vector{String}, operand::Vector{Int})
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 evaluation of this expression.
The basic algebra ope... | __label__POS | 0.93084 |
"""
order_by_points(nums::Vector{Int})::Vector{Int}
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 based on their index in original list.
# Examples
```jldoctest
julia> ... | __label__POS | 0.99952 |
"""
sort_numbers(numbers::String)::String
Input is a space-delimited string of numberals from "zero" to "nine". Valid
choices are "zero", "one", "two", "three", "four", "five", "six", "seven",
"eight" and "nine". Return the string with numbers sorted from smallest to
largest
# Examples
```jldoctest
julia> sort... | __label__POS | 0.873319 |
"""
compare_one(a::Union{Integer, AbstractFloat, AbstractString}, b::Union{Integer, AbstractFloat, AbstractString})::Union{Integer, AbstractFloat, AbstractString, Nothing}
Create a function that takes integers, floats, or strings representing real
numbers, and returns the larger variable in its given variable type... | __label__POS | 0.872833 |
"""
simplify(x::String, n::String)::Bool
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 representation of a fraction, and have the
following format, <numerator>/<denominator> ... | __label__POS | 0.697337 |
"""
sort_array_based_on_head_tail(xs::Int)::Vector{Int}
Given an array of non-negative integers, return a copy of the given array after
sorting, you will sort the given array in ascending order if the sum( first
index value, last index value) is odd, or sort it in descending order if the
sum( first index value, la... | __label__POS | 0.999046 |
"""
get_row(xs::Vector{Vector{Int}}, x::Int)::Vector{Tuple{Int, Int}}
You are given a 2 dimensional data, as a nested lists, which is similar to
matrix, however, unlike matrices, each row may contain a different number of
columns. Given `xs`, and integer `x`, find integers `x` in the list `xs`, and
return list of ... | __label__POS | 0.978317 |
"""
histogram(s::String)::Dict{String, Int}
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 occurrence, return all of
them.
# Examples
```jldoctest
julia> histogram... | __label__POS | 0.972292 |
"""
odd_count(xs::Vector{String})::Vector{String}
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 should be replaced by the number
of odd digits in the i"th strin... | __label__POS | 0.995117 |
"""
match_parens(lst::Vector{String})::String
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 order, that the resulting string will be
good. A string S is considered to be ... | __label__POS | 0.999077 |
"""
file_name_check(file_name::String)::String
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 if all the following conditions are met:
- There should not be more tha... | __label__POS | 0.963345 |
"""
even_odd_palindrome(n::Int)::Tuple{Int, Int}
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.
!!! note
1. 1 <= n <= 10^3
2. returned tuple has the number of even and odd integer palindromes respectively.
... | __label__POS | 0.997498 |
"""
intersection(interval1::Vector{Int}, interval2::Vector{Int})::String
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) includes both start and end. For each given
inter... | __label__POS | 0.999852 |
"""
min_path(grid::Vector{Vector{Int}}, k::Int)::Vector{Int}
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 the grid.
You have to find the minimum path ... | __label__POS | 0.999574 |
"""
Returns encoded string by shifting every character by 5 in the alphabet.
"""
function encode_shift(s::String)::String
join(((x - 'a' + 5 + 26) % 26 + 'a' for x in s))
end
"""
Takes as input string encoded with `encode_shift` function. Returns decoded string.
"""
\\nfunction decode_shift(s::String)::String\n ... | __label__POS | 0.996719 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.