Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Balloons | Problems
Binary Search in Python
course content

Зміст курсу

Binary Search in Python

Binary Search in Python

1. Binary Search
2. Problems

Balloons

Imagine you have this figure:

And you want to fill this figure with balloons!

If you have 3 balloons you will need 2 columns to fill them with balloons.

If you have 6 balloons you will need 3 columns to fill them with balloons.

If you have 7 balloons you will need 3 columns to fill them with balloons(in our problem).

Now we will implement the program, which will decide how many columns you need to locate the n number of ballons!

Look at the explanation of the task! How does it work?

Use hints if needed! Be careful with the tabulation!

Завдання

  1. Set while loop to work while the left + 1 is lower than right.
  2. Set the middle variable. The middle equals the (left + right) // 2.
  3. Update the left. The left equals the middle.
  4. Update the right. The right equals the middle.

Завдання

  1. Set while loop to work while the left + 1 is lower than right.
  2. Set the middle variable. The middle equals the (left + right) // 2.
  3. Update the left. The left equals the middle.
  4. Update the right. The right equals the middle.

Все було зрозуміло?

Секція 2. Розділ 4
toggle bottom row

Balloons

Imagine you have this figure:

And you want to fill this figure with balloons!

If you have 3 balloons you will need 2 columns to fill them with balloons.

If you have 6 balloons you will need 3 columns to fill them with balloons.

If you have 7 balloons you will need 3 columns to fill them with balloons(in our problem).

Now we will implement the program, which will decide how many columns you need to locate the n number of ballons!

Look at the explanation of the task! How does it work?

Use hints if needed! Be careful with the tabulation!

Завдання

  1. Set while loop to work while the left + 1 is lower than right.
  2. Set the middle variable. The middle equals the (left + right) // 2.
  3. Update the left. The left equals the middle.
  4. Update the right. The right equals the middle.

Завдання

  1. Set while loop to work while the left + 1 is lower than right.
  2. Set the middle variable. The middle equals the (left + right) // 2.
  3. Update the left. The left equals the middle.
  4. Update the right. The right equals the middle.

Все було зрозуміло?

Секція 2. Розділ 4
toggle bottom row

Balloons

Imagine you have this figure:

And you want to fill this figure with balloons!

If you have 3 balloons you will need 2 columns to fill them with balloons.

If you have 6 balloons you will need 3 columns to fill them with balloons.

If you have 7 balloons you will need 3 columns to fill them with balloons(in our problem).

Now we will implement the program, which will decide how many columns you need to locate the n number of ballons!

Look at the explanation of the task! How does it work?

Use hints if needed! Be careful with the tabulation!

Завдання

  1. Set while loop to work while the left + 1 is lower than right.
  2. Set the middle variable. The middle equals the (left + right) // 2.
  3. Update the left. The left equals the middle.
  4. Update the right. The right equals the middle.

Завдання

  1. Set while loop to work while the left + 1 is lower than right.
  2. Set the middle variable. The middle equals the (left + right) // 2.
  3. Update the left. The left equals the middle.
  4. Update the right. The right equals the middle.

Все було зрозуміло?

Imagine you have this figure:

And you want to fill this figure with balloons!

If you have 3 balloons you will need 2 columns to fill them with balloons.

If you have 6 balloons you will need 3 columns to fill them with balloons.

If you have 7 balloons you will need 3 columns to fill them with balloons(in our problem).

Now we will implement the program, which will decide how many columns you need to locate the n number of ballons!

Look at the explanation of the task! How does it work?

Use hints if needed! Be careful with the tabulation!

Завдання

  1. Set while loop to work while the left + 1 is lower than right.
  2. Set the middle variable. The middle equals the (left + right) // 2.
  3. Update the left. The left equals the middle.
  4. Update the right. The right equals the middle.

Секція 2. Розділ 4
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt