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!
Aufgabe
Swipe to start coding
- 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
.
Lösung
War alles klar?
Danke für Ihr Feedback!
Abschnitt 2. Kapitel 2
single
Fragen Sie AI
Fragen Sie AI
Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen
Suggested prompts:
Zusammenfassen Sie dieses Kapitel
Code in file erklären
Erklären, warum file die Aufgabe nicht löst
Awesome!
Completion rate improved to 14.29
Arrays Intersection
Swipe um das Menü anzuzeigen
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!
Aufgabe
Swipe to start coding
- 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
.
Lösung
War alles klar?
Danke für Ihr Feedback!
Awesome!
Completion rate improved to 14.29Abschnitt 2. Kapitel 2
single