Зміст курсу
Binary Search in Python
Binary Search in Python
Arrays Intersection
Now we will try to create a program that will find the intersection of the 2 arrays.
Look at the explanation of the task! How does it work?
Use hints if needed! Be careful with the tabulation!
Завдання
- Set while loop to work while the
left
is lower than theright
. - Set the
middle
variable. Themiddle
equals the(left + right) // 2
. - Set the condition if the middle element is greater or equals the
x
. - Update the
left
. Theleft
equals themiddle + 1
. - Create an empty array to fill it with values to test the function.
- Set for loop to work with the
nums
array. - Append the
i
to theintersection_nums
. - Print the
intersection_nums
.
Дякуємо за ваш відгук!
Arrays Intersection
Now we will try to create a program that will find the intersection of the 2 arrays.
Look at the explanation of the task! How does it work?
Use hints if needed! Be careful with the tabulation!
Завдання
- Set while loop to work while the
left
is lower than theright
. - Set the
middle
variable. Themiddle
equals the(left + right) // 2
. - Set the condition if the middle element is greater or equals the
x
. - Update the
left
. Theleft
equals themiddle + 1
. - Create an empty array to fill it with values to test the function.
- Set for loop to work with the
nums
array. - Append the
i
to theintersection_nums
. - Print the
intersection_nums
.
Дякуємо за ваш відгук!
Arrays Intersection
Now we will try to create a program that will find the intersection of the 2 arrays.
Look at the explanation of the task! How does it work?
Use hints if needed! Be careful with the tabulation!
Завдання
- Set while loop to work while the
left
is lower than theright
. - Set the
middle
variable. Themiddle
equals the(left + right) // 2
. - Set the condition if the middle element is greater or equals the
x
. - Update the
left
. Theleft
equals themiddle + 1
. - Create an empty array to fill it with values to test the function.
- Set for loop to work with the
nums
array. - Append the
i
to theintersection_nums
. - Print the
intersection_nums
.
Дякуємо за ваш відгук!
Now we will try to create a program that will find the intersection of the 2 arrays.
Look at the explanation of the task! How does it work?
Use hints if needed! Be careful with the tabulation!
Завдання
- Set while loop to work while the
left
is lower than theright
. - Set the
middle
variable. Themiddle
equals the(left + right) // 2
. - Set the condition if the middle element is greater or equals the
x
. - Update the
left
. Theleft
equals themiddle + 1
. - Create an empty array to fill it with values to test the function.
- Set for loop to work with the
nums
array. - Append the
i
to theintersection_nums
. - Print the
intersection_nums
.