Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate draft translations #14

Merged
merged 6 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions translation/drafts/0
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
""" Check if in given list of numbers, are any two numbers closer to each other than
given threshold.
>>> has_close_elements([1.0, 2.0, 3.0], 0.5)
False
>>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3)
True
"""

"""
Diye gaye numbers ki list mein, kya koi do numbers ek dusre se diye gaye threshold se zyada close hain.
>>> has_close_elements([1.0, 2.0, 3.0], 0.5)
False
>>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3)
True
"""
16 changes: 16 additions & 0 deletions translation/drafts/1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
""" 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 nested within each other
Ignore any spaces in the input string.
>>> separate_paren_groups('( ) (( )) (( )( ))')
['()', '(())', '(()())']
"""

"""
Is function ka input ek string hota hai jisme multiple groups hote hain nested parentheses ke. Aapka goal hai
un groups ko alag alag strings me separate karna aur unki list return karni hai.
Separate groups balanced hote hain (har open brace sahi se close hota hai) aur ek dusre ke andar nested nahi hote
Input string me koi bhi spaces ko ignore karo.
>>> separate_paren_groups('( ) (( )) (( )( ))')
['()', '(())', '(()())']
"""
5 changes: 5 additions & 0 deletions translation/drafts/10
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
""" Test if given string is a palindrome """

"""
Diye gaye string ko check karo ki woh palindrome hai ya nahi.
"""
27 changes: 27 additions & 0 deletions translation/drafts/100
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""
Given a positive integer n, you have to make a pile of n levels of stones.
The first level has n stones.
The number of stones in the next level is:
- the next odd number if n is odd.
- the next even number if n is even.
Return the number of stones in each level in a list, where element at index
i represents the number of stones in the level (i+1).

Examples:
>>> make_a_pile(3)
[3, 5, 7]
"""

"""
Ek positive integer n diya gaya hai, aapko n levels ki ek pile of stones banani hai.
Pehle level me n stones honge.
Agla level stones ka number hoga:
- agla odd number agar n odd hai.
- agla even number agar n even hai.
Har level me stones ki sankhya ko ek list me return karo, jaha index
i ki element level (i+1) me stones ki sankhya ko darshata hai.

Udaharan:
>>> make_a_pile(3)
[3, 5, 7]
"""
17 changes: 17 additions & 0 deletions translation/drafts/101
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""
You will be given a string of words separated by commas or spaces. Your task is
to split the string into words and return an array of the words.

For example:
words_string("Hi, my name is John") == ["Hi", "my", "name", "is", "John"]
words_string("One, two, three, four, five, six") == ["One", "two", "three", "four", "five", "six"]
"""

"""
Aapko ek string di jayegi jisme words commas ya spaces se separated honge. Aapka task hai
string ko words mein split karna aur words ki array return karna.

Jaise ki:
words_string("Hi, my name is John") == ["Hi", "my", "name", "is", "John"]
words_string("One, two, three, four, five, six") == ["One", "two", "three", "four", "five", "six"]
"""
18 changes: 18 additions & 0 deletions translation/drafts/102
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""This function takes two positive numbers x and y and returns the
biggest even integer number that is in the range [x, y] inclusive. If
there's no such number, then the function should return -1.

For example:
choose_num(12, 15) = 14
choose_num(13, 12) = -1
"""

"""
Yeh function do positive numbers x aur y leta hai aur return karta hai
sabse bada even integer jo range [x, y] mein inclusive hai. Agar
aisa koi number nahi hai, toh function ko -1 return karna chahiye.

Jaise ki:
choose_num(12, 15) = 14
choose_num(13, 12) = -1
"""
22 changes: 22 additions & 0 deletions translation/drafts/103
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""You are given two positive integers n and m, and your task is to compute the
average of the integers from n through m (including n and m).
Round the answer to the nearest integer and convert that to binary.
If n is greater than m, return -1.
Example:
rounded_avg(1, 5) => "0b11"
rounded_avg(7, 5) => -1
rounded_avg(10, 20) => "0b1111"
rounded_avg(20, 33) => "0b11010"
"""

"""
Aapko do positive integers n aur m diye gaye hain, aur aapka task hai n se lekar m tak ke integers ka
average compute karna (n aur m ko bhi include karte hue).
Answer ko nearest integer tak round karo aur usko binary mein convert karo.
Agar n m se bada hai, to -1 return karo.
Udaharan:
rounded_avg(1, 5) => "0b11"
rounded_avg(7, 5) => -1
rounded_avg(10, 20) => "0b1111"
rounded_avg(20, 33) => "0b11010"
"""
23 changes: 23 additions & 0 deletions translation/drafts/104
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""Given a list of positive integers x. return a sorted list of all
elements that hasn't any even digit.

Note: Returned list should be sorted in increasing order.

For example:
>>> unique_digits([15, 33, 1422, 1])
[1, 15, 33]
>>> unique_digits([152, 323, 1422, 10])
[]
"""

"""
Diye gaye positive integers ki list x. Woh saare elements return karo jo sorted list me hai aur jisme koi bhi even digit nahi hai.

Dhyan de: Return ki gayi list ko increasing order me sort kiya jana chahiye.

Jaise ki:
>>> unique_digits([15, 33, 1422, 1])
[1, 15, 33]
>>> unique_digits([152, 323, 1422, 10])
[]
"""
43 changes: 43 additions & 0 deletions translation/drafts/105
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"""
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".

For example:
arr = [2, 1, 1, 4, 5, 8, 2, 3]
-> sort arr -> [1, 1, 2, 2, 3, 4, 5, 8]
-> reverse arr -> [8, 5, 4, 3, 2, 2, 1, 1]
return ["Eight", "Five", "Four", "Three", "Two", "Two", "One", "One"]

If the array is empty, return an empty array:
arr = []
return []

If the array has any strange number ignore it:
arr = [1, -1 , 55]
-> sort arr -> [-1, 1, 55]
-> reverse arr -> [55, 1, -1]
return = ['One']
"""

"""
Ek array diya gaya hai integers ka, integers ko sort karo jo 1 se 9 ke beech mein hai,
resulting array ko reverse karo, aur phir har digit ko uske corresponding name se replace karo
"One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine".

Jaise ki:
arr = [2, 1, 1, 4, 5, 8, 2, 3]
-> arr ko sort karo -> [1, 1, 2, 2, 3, 4, 5, 8]
-> arr ko reverse karo -> [8, 5, 4, 3, 2, 2, 1, 1]
return ["Eight", "Five", "Four", "Three", "Two", "Two", "One", "One"]

Agar array khali hai, toh ek khali array return karo:
arr = []
return []

Agar array mein koi ajeeb number hai toh use ignore karo:
arr = [1, -1 , 55]
-> arr ko sort karo -> [-1, 1, 55]
-> arr ko reverse karo -> [55, 1, -1]
return = ['One']
"""
18 changes: 18 additions & 0 deletions translation/drafts/106
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
""" 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 the numbers from 1 to i (1 * 2 * ... * i).
Example:
f(5) == [1, 2, 6, 24, 15]
"""

"""
Function f ko implement karo jo n ko parameter ke roop mein leta hai,
aur ek list return karta hai jiska size n hota hai, aisa ki index i par element ka value i ka factorial hota hai agar i even hai
ya fir 1 se lekar i tak ke numbers ka sum hota hai otherwise.
i ka start 1 se hota hai.
i ka factorial 1 se lekar i tak ke numbers ka multiplication hota hai (1 * 2 * ... * i).
Udaharan:
f(5) == [1, 2, 6, 24, 15]
"""
45 changes: 45 additions & 0 deletions translation/drafts/107
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
"""
Given a positive integer n, return a tuple that has the number of even and odd
integer palindromes that fall within the range(1, n), inclusive.

Example 1:

Input: 3
Output: (1, 2)
Explanation:
Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd.

Example 2:

Input: 12
Output: (4, 6)
Explanation:
Integer palindrome are 1, 2, 3, 4, 5, 6, 7, 8, 9, 11. four of them are even, and 6 of them are odd.

Note:
1. 1 <= n <= 10^3
2. returned tuple has the number of even and odd integer palindromes respectively.
"""

"""
Ek positive integer n diya gaya hai, return karo ek tuple jisme even aur odd integer palindromes ki sankhya ho jo range(1, n) ke andar aate hain, inclusive.

Udaharan 1:

Input: 3
Output: (1, 2)
Explanation:
Integer palindrome hain 1, 2, 3. Inme se ek even hai, aur do odd hain.

Udaharan 2:

Input: 12
Output: (4, 6)
Explanation:
Integer palindrome hain 1, 2, 3, 4, 5, 6, 7, 8, 9, 11. Inme se chaar even hain, aur 6 odd hain.

Dhyan de:
1. 1 <= n <= 10^3
2. returned tuple me even aur odd integer palindromes ki sankhya kramashah hoti hai.

"""
19 changes: 19 additions & 0 deletions translation/drafts/108
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""
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.
>>> count_nums([]) == 0
>>> count_nums([-1, 11, -11]) == 1
>>> count_nums([1, 1, 2]) == 3
"""

"""
Ek function likho count_nums jo ek array of integers leta hai aur return karta hai
un elements ki sankhya jinka digits ka sum > 0 hota hai.
Agar koi number negative hai, to uska pehla signed digit negative hoga:
jaise ki -123 ke signed digits hote hai -1, 2, aur 3.
>>> count_nums([]) == 0
>>> count_nums([-1, 11, -11]) == 1
>>> count_nums([1, 1, 2]) == 3
"""
46 changes: 46 additions & 0 deletions translation/drafts/109
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
"""We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The
numbers in the array will be randomly ordered. Your task is to determine if
it is possible to get an array sorted in non-decreasing order by performing
the following operation on the given array:
You are allowed to perform right shift operation any number of times.

One right shift operation means shifting all elements of the array by one
position in the right direction. The last element of the array will be moved to
the starting position in the array i.e. 0th index.

If it is possible to obtain the sorted array by performing the above operation
then return True else return False.
If the given array is empty then return True.

Note: The given list is guaranteed to have unique elements.

For Example:

move_one_ball([3, 4, 5, 1, 2])==>True
Explanation: By performin 2 right shift operations, non-decreasing order can
be achieved for the given array.
move_one_ball([3, 5, 4, 1, 2])==>False
Explanation:It is not possible to get non-decreasing order for the given
array by performing any number of right shift operations.

"""

"""
Humare paas ek array 'arr' hai N integers arr[1], arr[2], ..., arr[N] ka. Array mein numbers randomly order mein honge. Aapka task hai yeh determine karna ki kya hume non-decreasing order mein sorted array mil sakta hai, diye gaye array par niche diye gaye operation ko perform karke:
Aapko right shift operation ko kitni bhi baar perform karne ki anumati hai.

Ek right shift operation ka matlab hai array ke saare elements ko ek position right direction mein shift karna. Array ka last element array ke starting position yaani 0th index par move ho jayega.

Agar upar diye gaye operation ko perform karke sorted array mil sakta hai to True return karo, nahi to False return karo.
Agar diya gaya array khali hai to True return karo.

Note: Diye gaye list mein unique elements honge.

Udaharan ke liye:

move_one_ball([3, 4, 5, 1, 2])==>True
Explanation: 2 right shift operations perform karke, diye gaye array ke liye non-decreasing order prapt kiya ja sakta hai.
move_one_ball([3, 5, 4, 1, 2])==>False
Explanation: Kisi bhi number of right shift operations perform karke diye gaye array ke liye non-decreasing order prapt karna sambhav nahi hai.

"""
12 changes: 12 additions & 0 deletions translation/drafts/11
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
""" Input are two strings a and b consisting only of 1s and 0s.
Perform binary XOR on these inputs and return result also as a string.
>>> string_xor('010', '110')
'100'
"""

"""
Input do strings a aur b honge jo sirf 1s aur 0s se bane honge.
In inputs par binary XOR perform karo aur result ko bhi ek string ke roop mein return karo.
>>> string_xor('010', '110')
'100'
"""
26 changes: 26 additions & 0 deletions translation/drafts/110
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""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 elements between lst1 and lst2.
If it is possible to exchange elements between the lst1 and lst2 to make
all the elements of lst1 to be even, return "YES".
Otherwise, return "NO".
For example:
exchange([1, 2, 3, 4], [1, 2, 3, 4]) => "YES"
exchange([1, 2, 3, 4], [1, 5, 3, 4]) => "NO"
It is assumed that the input lists will be non-empty.
"""

"""
Is problem mein, aapko ek function implement karna hai jo do list of numbers leta hai,
aur yeh determine karta hai ki kya inke beech elements ka exchange karke
lst1 ko sirf even numbers ki list banaya ja sakta hai.
lst1 aur lst2 ke beech exchanged elements ki sankhya par koi limit nahi hai.
Agar lst1 aur lst2 ke beech elements exchange karke
lst1 ke saare elements ko even banaya ja sakta hai, to "YES" return karo.
Varna, "NO" return karo.
Jaise ki:
exchange([1, 2, 3, 4], [1, 2, 3, 4]) => "YES"
exchange([1, 2, 3, 4], [1, 5, 3, 4]) => "NO"
Maan liya jata hai ki input lists khali nahi hogi.
"""
Loading