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

Contenido del Curso

Binary Search in Python

Binary Search in Python

1. Binary Search
2. Problems

book
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!

Tarea

Swipe to start coding

  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.

Solución

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 2. Capítulo 4
toggle bottom row

book
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!

Tarea

Swipe to start coding

  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.

Solución

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 2. Capítulo 4
Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Lamentamos que algo salió mal. ¿Qué pasó?
some-alt