content stringlengths 263 5.24M | pred_label stringclasses 1
value | pred_score_pos float64 0.6 1 |
|---|---|---|
"""
count_nums(xs::Vector{Int})::Int
Write a function `count_nums` 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: e.g. -123 has signed digits -1, 2, and
3.
# Examples
```jldoctest
julia> cou... | __label__POS | 0.999999 |
"""
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.993119 |
"""
closest_integer(value::String)::Int
Create a function that takes a value (string) representing a number and returns
the closest integer to it. If the number is equidistant from two integers, round
it away from zero.
!!! note
Rounding away from zero means that if the given number is equidistant
from t... | __label__POS | 0.993605 |
"""
cycpattern_check(a::String , b::String)::Bool
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.
# Example
```jldoctest
julia> cycpattern_check("abcd", "abd")
false
julia> cycpattern_check("hello", "ell")
true
julia> cycpattern_chec... | __label__POS | 0.983045 |
"""
prime_length(s::String)::Bool
Write a function that takes a `s` and returns `true` if `s` length is a prime
number or `false` otherwise.
# Examples
```jldoctest
julia> prime_length("Hello")
true
julia> prime_length("abcdcba")
true
julia> prime_length("kittens")
true
julia> prime_length("orange")
false
```... | __label__POS | 1.000005 |
"""
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.99494 |
"""
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
```
"""
# Step 1: Check if a number is prime
f... | __label__POS | 0.999779 |
"""
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.999444 |
"""
factorize(n::Int)::Vector{Int}
Return list of prime factors of given integer in the order from smallest to
largest. Each of the factors should be listed number of times corresponding to
how many times it appeares in factorization. Input number should be equal to the
product of all factors.
# Examples
```jldo... | __label__POS | 0.903208 |
"""
sum_squares(xs::Vector{Int})::Int
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 multiple of 4 and not a multiple of 3.
The function will not change the entrie... | __label__POS | 0.991958 |
"""
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.998512 |
"""
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.929855 |
"""
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.999247 |
"""
parse_nested_parens(paren_string::String)::Vector{Int}
Input to this function is a string represented multiple groups for nested
parentheses separated by spaces. For each of the group, output the deepest level
of nesting of parentheses. E.g. `(()())` has maximum two levels of nesting while
`((()))` has three.
... | __label__POS | 0.999569 |
"""
check_if_last_char_is_a_letter(s::String)::Bool
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 separated by space.
# Examples
```jldoctest
julia> check_if_las... | __label__POS | 0.995642 |
"""
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.999988 |
"""
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.999563 |
"""
prod_signs(xs::Vector{Int})::Union{Nothing,Int}
You are given an array `xs` 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 None for empty `xs`.
Example: julia> prod_signs([1, 2, 2, -4]) -9... | __label__POS | 0.99984 |
"""
remove_vowels(text::String)::String
`remove_vowels` is a function that takes string and returns string without vowels.
# Examples
```jldoctest
julia> remove_vowels("")
""
julia> remove_vowels("abcdef\\nghijklm")
"bcdf\\nghjklm"
julia> remove_vowels("abcdef")
"bcdf"
julia> remove_vowels("aaaaa")
""
julia>... | __label__POS | 0.905074 |
"""
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.908652 |
"""
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.994401 |
"""
find_closest_elements(numbers::Vector{Float64})::Tuple{Float64, Float64}
From a supplied list of numbers (of length at least two) select and return two
that are the closest to each other and return them in order (smaller number,
larger number).
# Examples
```jldoctest
julia> find_closest_elements([1.0, 2.0, ... | __label__POS | 0.994809 |
"""
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.999994 |
"""
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.997891 |
"""
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.976134 |
"""
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.998131 |
"""
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.938813 |
"""
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.86524 |
"""
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.999459 |
"""
check_dict_case(d::Dict{String})::Bool
Given a dictionary, return `true` if all keys are strings in lower case or all
keys are strings in upper case, else return `false`. The function should return
`false` is the given dictionary is empty.
# Examples
```jldoctest
julia> check_dict_case(Dict("a" => "apple", "... | __label__POS | 0.739893 |
"""
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.99872 |
"""
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.988508 |
"""
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.996348 |
"""
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.999136 |
"""
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.999216 |
"""
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.990286 |
"""
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.999457 |
"""
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.973476 |
"""
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.878252 |
"""
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.982455 |
"""
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.66764 |
"""
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.911076 |
"""
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.999489 |
"""
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.985374 |
"""
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.999975 |
"""
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.997534 |
"""
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.950969 |
"""
parse_nested_parens(paren_string::String)::Vector{Int}
Input to this function is a string represented multiple groups for nested
parentheses separated by spaces. For each of the group, output the deepest level
of nesting of parentheses. E.g. `(()())` has maximum two levels of nesting while
`((()))` has three.
... | __label__POS | 0.963278 |
"""
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.999932 |
"""
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.999611 |
"""
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.912079 |
"""
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.999988 |
"""
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.996861 |
"""
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.991862 |
"""
triples_sum_to_zero(l::Vector{Int})::Bool
Takes a list of integers as an input. It returns `true` if there are three
distinct elements in the list that sum to zero, and `false` otherwise.
# Examples
```jldoctest
julia> triples_sum_to_zero([1, 3, 5, 0])
false
julia> triples_sum_to_zero([1, 3, -2, 1])
true
j... | __label__POS | 0.999753 |
"""
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.998247 |
"""
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.997386 |
"""
strange_sort_list(xs::Vector{Int})::Vector{Int}
Given list of integers, return list in strange order. Strange sorting, is when
you start with the minimum value, then maximum of the remaining integers, then
minimum and so on.
# Examples
```jldoctest
julia> strange_sort_list([1, 2, 3, 4])
4-element Vector{Int6... | __label__POS | 0.999634 |
"""
encrypt(s::String)
Create a function `encrypt` that takes a string as an argument and returns a
string encrypted with the alphabet being rotated. The alphabet should be rotated
in a manner such that the letters shift down by two multiplied to two places.
# Example
```jldoctest
julia> encrypt("hi")
"lm"
juli... | __label__POS | 0.738512 |
"""
words_in_sentence(sentence::String)::String
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 lengths are prime numbers, the order of the
words in the new string should... | __label__POS | 0.997275 |
"""
prime_fib(n::Int)::Int
Returns n-th number that is a Fibonacci number and it's also prime.
```jldoctest
julia> prime_fib(1)
2
julia> prime_fib(2)
3
julia> prime_fib(3)
5
julia> prime_fib(4)
13
julia> prime_fib(5)
89
```
"""
# Step 1: Define a helper function to check if a number is prime
function is_prim... | __label__POS | 0.999994 |
"""
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.998943 |
"""
change_base(x::Int, base::Int)::String
Change numerical base of input number x to base. Return string representation
after the conversion. base numbers are less than 10.
# Examples
```jldoctest
julia> change_base(8, 3)
"22"
julia> change_base(8, 2)
"1000"
julia> change_base(7, 2)
"111"
```
"""
function cha... | __label__POS | 0.989506 |
"""
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.930508 |
"""
car_race_collision(n::Int)::Int
Imagine a road that's a perfectly straight infinitely long line. `n` cars are
driving left to right; simultaneously, a different set of n cars are driving
right to left. The two sets of cars start out being very far from each other.
All cars move in the same speed. Two cars are ... | __label__POS | 0.978249 |
"""
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.887832 |
"""
correct_angle_bracketing(brackets::String)::Bool
Brackets is a string of "<" and ">". Return true if every opening bracket has a
corresponding closing bracket.
# Examples
```jldoctest
julia> correct_angle_bracketing("<")
false
julia> correct_angle_bracketing("<>")
true
julia> correct_angle_bracketing("<<><... | __label__POS | 0.966751 |
"""
is_nested(s::String)::Bool
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 in the subsequence is nested.
# Examples
```jldoctest
julia> is_nested("[[]]")
tr... | __label__POS | 0.999549 |
"""
count_digits(n::Int)::Int
Given a positive integer n, return the product of the odd digits. Return 0 if
all digits are even.
# Example
```jldoctest
julia> count_digits(1)
1
julia> count_digits(4)
0
julia> count_digits(235)
15
```
"""
function count_digits(n::Int)::Int
# Step 1: Initialize the product o... | __label__POS | 1.000005 |
"""
specialFilter(nums::Vector{Int})::Int
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).
# Example
```jldoctest
julia> specialFilter([15, -73, 14, -15])
1
julia>... | __label__POS | 1.000005 |
"""
is_simple_power(x::Number, n::Number)::Bool
Your task is to write a function that returns `true` if a number `x` is a simple
power of `n` and `false` in other cases. `x` is a simple power of `n` if n ^
int = x.
# Examples:
```jldoctest
julia> is_simple_power(1, 4)
true
julia> is_simple_power(2, 2)
true
jul... | __label__POS | 0.999647 |
"""
even_odd_count(num::Int)::Tuple{Int, Int}
Given an integer, return a tuple that has the number of even and odd digits
respectively.
# Examples
```jldoctest
julia> even_odd_count(-12)
(1, 1)
julia> even_odd_count(123)
(1, 2)
```
"""
function even_odd_count(num::Int)::Tuple{Int, Int}
even_count = 0
od... | __label__POS | 0.999709 |
"""
iscube(a::Int)::Bool
Write a function that takes an integer `a` and returns `true` if this ingeger is a
cube of some integer number.
Note: you may assume the input is always valid.
# Examples
```jldoctest
julia> iscube(1)
true
julia> iscube(2)
false
julia> iscube(-1)
true
julia> iscube(64)
true
julia> i... | __label__POS | 0.991251 |
"""
f(n::Int)::Vector{Int}
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` otherwise. `i` starts from 1.
The factorial of `i` is the multiplication of t... | __label__POS | 0.998616 |
"""
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.999736 |
"""
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.999933 |
"""
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.999897 |
"""
check_dict_case(d::Dict{String})::Bool
Given a dictionary, return `true` if all keys are strings in lower case or all
keys are strings in upper case, else return `false`. The function should return
`false` is the given dictionary is empty.
# Examples
```jldoctest
julia> check_dict_case(Dict("a" => "apple", "... | __label__POS | 0.968004 |
"""
longest(xs::Vector{String})::Union{Nothing, String}
Out of list of strings, return the longest one. Return the first one in case of
multiple strings of the same length. Return `nothing` in case the input list is
empty.
# Examples
```jldoctest
julia> longest(String[])
julia> longest(["a", "b", "c"])
"a"
jul... | __label__POS | 0.998417 |
"""
get_max_triples(n::Int)::Int
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[k]) of a where i < j < k,
and a[i] + a[j] + a[k] is a multiple of 3.
# Examples
```jldocte... | __label__POS | 0.999924 |
"""
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.999953 |
"""
is_bored(s::String)::Int
You'll be given a string of words, and your task is to count the number of
boredoms. A boredom is a sentence that starts with the word "I". Sentences are
delimited by '.', '?' or '!'.
# Examples
```jldoctest
julia> is_bored("Hello world")
0
julia> is_bored("The sky is blue. The sun ... | __label__POS | 0.992595 |
"""
split_words(txt::String)::Union{Vector{<:AbstractString},Int}
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 letters with odd order in the
alphabet, ord("a") ... | __label__POS | 0.998653 |
"""
next_smallest(xs::Vector{Int})::Union{Nothing,Int}
You are given a list of integers. Write a function `next_smallest(xs)` that
returns the 2nd smallest element of the list. Return `nothing` if there is no
such element.
# Examples
```jldoctest
julia> next_smallest([1, 2, 3, 4, 5])
2
julia> next_smallest([5, ... | __label__POS | 0.999968 |
"""
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.948326 |
"""
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.998218 |
"""
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.999075 |
"""
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.96515 |
"""
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.757651 |
"""
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.999843 |
"""
monotonic(l::Vector)::Bool
Return true is list elements are monotonically increasing or decreasing.
# Examples
```jldoctest
julia> monotonic([1, 2, 4, 20])
true
julia> monotonic([1, 20, 4, 10])
false
julia> monotonic([4, 1, 0, -10])
true
```
"""
function monotonic(l::Vector)::Bool
# Step 1: Check for t... | __label__POS | 0.983236 |
"""
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.999078 |
"""
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.999666 |
"""
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.998001 |
"""
triangle_area3(a::Number, b::Number, c::Number)::Number
Given the lengths of the three sides of a triangle. Return the area of the
triangle rounded to 2 decimal points if the three sides form a valid triangle.
Otherwise return -1 Three sides make a valid triangle when the sum of any two
sides is greater than t... | __label__POS | 0.99934 |
"""
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.878798 |
"""
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.999046 |
"""
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.999721 |
"""
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.990196 |
"""
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.998797 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.