chore: import upstream snapshot with attribution
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
This commit is contained in:
+37
@@ -0,0 +1,37 @@
|
||||
---
|
||||
id: 698dcc2c7932b3cc4b19c927
|
||||
title: Binary Search in Code
|
||||
challengeType: 11
|
||||
videoId: mg7F5D8Wk5o
|
||||
dashedName: binary-search-in-code
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
In this video, you will code out the binary search algorithm using Python.
|
||||
|
||||
# --questions--
|
||||
|
||||
## --text--
|
||||
|
||||
Why was the `while first <= last:` condition used in the solution?
|
||||
|
||||
## --answers--
|
||||
|
||||
To ensure only the first half of the array is ever checked.
|
||||
|
||||
---
|
||||
|
||||
To make the loop run forever until manually stopped.
|
||||
|
||||
---
|
||||
|
||||
To skip checking the last element in the search range.
|
||||
|
||||
---
|
||||
|
||||
To keep searching while there are still elements in the range and stop when the range is empty.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
---
|
||||
id: 698dca057932b3cc4b19c926
|
||||
title: Linear Search in Code
|
||||
challengeType: 11
|
||||
videoId: bKkgjdPkL3A
|
||||
dashedName: linear-search-in-code
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
In this video, you will code out the linear search algorithm using Python.
|
||||
|
||||
# --questions--
|
||||
|
||||
## --text--
|
||||
|
||||
Which of the following is the correct way to write a linear search function?
|
||||
|
||||
## --answers--
|
||||
|
||||
```python
|
||||
def linear_search(list, target):
|
||||
for i in range(len(list) - 1):
|
||||
if list[i] == target:
|
||||
return i
|
||||
return -1
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```python
|
||||
def linear_search(list, target):
|
||||
for i in range(len(list)):
|
||||
if i == target:
|
||||
return i
|
||||
return -1
|
||||
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```python
|
||||
def linear_search(list, target):
|
||||
for i in range(len(list)):
|
||||
if list[i] == target:
|
||||
return i
|
||||
else:
|
||||
return -1
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```python
|
||||
def linear_search(list, target):
|
||||
for i in range(len(list)):
|
||||
if list[i] == target:
|
||||
return i
|
||||
return None
|
||||
```
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
---
|
||||
id: 698dce727932b3cc4b19c928
|
||||
title: Recursive Binary Search
|
||||
challengeType: 11
|
||||
videoId: RQNBzDoG_gA
|
||||
dashedName: recursive-binary-search
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
In this video, you will learn how to create a recursive solution for binary search.
|
||||
|
||||
# --questions--
|
||||
|
||||
## --text--
|
||||
|
||||
What is a recursive function?
|
||||
|
||||
## --answers--
|
||||
|
||||
A function that performs a calculation only once.
|
||||
|
||||
---
|
||||
|
||||
A function that calls itself.
|
||||
|
||||
---
|
||||
|
||||
A function that never returns a value.
|
||||
|
||||
---
|
||||
|
||||
A function that can only run in a loop.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
2
|
||||
Reference in New Issue
Block a user