|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "attachments": {}, |
| 5 | + "cell_type": "markdown", |
| 6 | + "metadata": {}, |
| 7 | + "source": [ |
| 8 | + "# Practice Code: 0008\n", |
| 9 | + "\n", |
| 10 | + "**Fill the water into all the bottles. Some are already full, while some are empty and some are partially filled.<br>\n", |
| 11 | + "Each bottle can contain X millilitres of water (dynamic, entered by user), while the capacity of Jar is 1 litre.<br>\n", |
| 12 | + "An array is given with the existing bottles on the table, with 0 to 10 as the values for each element, where 0 means its empty and 10 means its full.<br>\n", |
| 13 | + "Fill all the bottles and print how much additional water was used to fill all the bottle.**\n", |
| 14 | + "\n", |
| 15 | + "Come up with an optimal algorithm and implement it. Use least amount of variables and statements, but performance matters.\n", |
| 16 | + "\n", |
| 17 | + "Input: \n", |
| 18 | + "* Bottles - 5,6,10,0 \n", |
| 19 | + "* BottleCapacity - 1\n", |
| 20 | + "\n", |
| 21 | + "Output: **1.9 ltrs**\n", |
| 22 | + "\n", |
| 23 | + "#python #practiceCode #samples #interviewQuestions #collections #algorithm" |
| 24 | + ] |
| 25 | + }, |
| 26 | + { |
| 27 | + "cell_type": "code", |
| 28 | + "execution_count": null, |
| 29 | + "metadata": {}, |
| 30 | + "outputs": [], |
| 31 | + "source": [] |
| 32 | + } |
| 33 | + ], |
| 34 | + "metadata": { |
| 35 | + "kernelspec": { |
| 36 | + "display_name": "Python 3", |
| 37 | + "language": "python", |
| 38 | + "name": "python3" |
| 39 | + }, |
| 40 | + "language_info": { |
| 41 | + "codemirror_mode": { |
| 42 | + "name": "ipython", |
| 43 | + "version": 3 |
| 44 | + }, |
| 45 | + "file_extension": ".py", |
| 46 | + "mimetype": "text/x-python", |
| 47 | + "name": "python", |
| 48 | + "nbconvert_exporter": "python", |
| 49 | + "pygments_lexer": "ipython3", |
| 50 | + "version": "3.7.0" |
| 51 | + } |
| 52 | + }, |
| 53 | + "nbformat": 4, |
| 54 | + "nbformat_minor": 2 |
| 55 | +} |
0 commit comments