├── .idea └── modules.xml ├── Can you form a triangle March 5, 2021.ipynb ├── Expected number of flips until N heads March 6 2021.ipynb ├── Is the coin biased March 10 2021.ipynb ├── LICENSE ├── Minimim of two random variables March 3 2021.ipynb ├── README.md ├── Simulating the fair coin with a biased one with March 7 2021.ipynb ├── Unfair Coin March 4 2021.ipynb ├── Which game would you choose March 9 2021.ipynb └── fair coins and double head coin April 6 2021.ipynb /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Expected number of flips until N heads March 6 2021.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "ExecuteTime": { 7 | "end_time": "2021-03-03T15:06:18.500645Z", 8 | "start_time": "2021-03-03T15:06:18.455823Z" 9 | } 10 | }, 11 | "source": [ 12 | "sergazy.nurbavliyev@gmail.com © 2021" 13 | ] 14 | }, 15 | { 16 | "cell_type": "markdown", 17 | "metadata": {}, 18 | "source": [ 19 | "## Expected Number of flips until N heads" 20 | ] 21 | }, 22 | { 23 | "cell_type": "markdown", 24 | "metadata": {}, 25 | "source": [ 26 | "Question: Assume we have a fair coin. What is the expected number of coin flips needed to get $N$ consecutive heads." 27 | ] 28 | }, 29 | { 30 | "cell_type": "markdown", 31 | "metadata": {}, 32 | "source": [ 33 | "### Intuition" 34 | ] 35 | }, 36 | { 37 | "cell_type": "markdown", 38 | "metadata": {}, 39 | "source": [ 40 | "Let us solve this for $N=2$ first. Then we will generalize the idea for any $N$. Let $X$ denote the number of flips that we need to get two consecutive heads. Then we want to find $\\mathbb{E}[X]$. We will denote the flip that results in head with $H$ and in tails as $T$. \n", 41 | "Then we can write $\\mathbb{E}[X]$ as:\n", 42 | "\\begin{equation}\n", 43 | "\\mathbb{E}[X]=\\mathbb{P}(H)(1+\\mathbb{E}[X|H])+\\mathbb{P}(T)(1+\\mathbb{E}[X|T])=\\frac{1}{2}(1+\\mathbb{E}[X|H])+\\frac{1}{2}(1+\\mathbb{E}[X|T])\n", 44 | "\\end{equation}\n", 45 | "where we conditioned on our first flip. Note that $\\mathbb{E}[X|T])=\\mathbb{E}[X])$ because after we see tails we need to start over again to see two consecutive heads. Then equation (1) becomes\n", 46 | "\\begin{equation}\n", 47 | "\\mathbb{E}[X]=\\frac{1}{2}(1+\\mathbb{E}[X|H])+\\frac{1}{2}(1+\\mathbb{E}[X])\n", 48 | "\\end{equation}\n", 49 | "Now we need to solve $\\mathbb{E}[X|H]$. We will conditioned further if we can get rid of these terms. Then we have\n", 50 | "\\begin{equation}\n", 51 | "\\mathbb{E}[X|H]=\\mathbb{P}(H)(1+\\mathbb{E}[X|HH])+\\mathbb{P}(T)(1+\\mathbb{E}[X|HT])=\\frac{1}{2}(1+\\mathbb{E}[X|HH])+\\frac{1}{2}(1+\\mathbb{E}[X|HT])\n", 52 | "\\end{equation}\n", 53 | "From here we can see that $\\mathbb{E}[X|HH]=0$ because we already see the pattern, and $\\mathbb{E}[X|HT])=\\mathbb{E}[X])$ since we need to start over again. The equation (3) will be \n", 54 | "\\begin{equation}\n", 55 | "\\mathbb{E}[X|H]=\\frac{1}{2}(1+0)+\\frac{1}{2}(1+\\mathbb{E}[X])=1+\\frac{1}{2}\\mathbb{E}[X]\n", 56 | "\\end{equation}\n", 57 | "So equation (2) will be \n", 58 | "\\begin{equation}\n", 59 | "\\mathbb{E}[X]=\\frac{1}{2}(1+\\mathbb{E}[X|H])+\\frac{1}{2}(1+\\mathbb{E}[X])=\\frac{1}{2}(1+(1+\\frac{1}{2}\\mathbb{E}[X]))+\\frac{1}{2}(1+\\mathbb{E}[X])=\\frac{1}{2}(2+\\frac{1}{2}\\mathbb{E}[X]))+\\frac{1}{2}(1+\\mathbb{E}[X])\n", 60 | "\\end{equation}\n", 61 | "After multiplying by 8 both sides we get\n", 62 | "\\begin{equation}\n", 63 | "8\\mathbb{E}[X]=4(2+\\frac{1}{2}\\mathbb{E}[X]))+4(1+\\mathbb{E}[X])=8+2\\mathbb{E}[X]))+4+4\\mathbb{E}[X])\\Rightarrow 2\\mathbb{E}[X] =12\\Rightarrow \\mathbb{E}[X] =6\n", 64 | "\\end{equation}" 65 | ] 66 | }, 67 | { 68 | "cell_type": "markdown", 69 | "metadata": {}, 70 | "source": [ 71 | "## Theoritical result" 72 | ] 73 | }, 74 | { 75 | "cell_type": "markdown", 76 | "metadata": {}, 77 | "source": [ 78 | "Lets denote $\\mathbb{E}_N$ for $N$ consecutive heads. With the same logic above, if we get one more head after $\\mathbb{E}_{N-1}$, then we are done because we would have $N$ consecutive heads. But if it is a tail then we need to start over again. Thus there are two cases:\n", 79 | "\n", 80 | "If we have a head, $\\mathbb{E}_{N-1}+1$.\n", 81 | "\n", 82 | "If we have a tail, $\\mathbb{E}_{N}+1$.\n", 83 | "\n", 84 | "\\begin{equation}\n", 85 | "\\mathbb{E}_{N}= \\mathbb{P}(H)(\\mathbb{E}_{N-1}+1)+\\mathbb{P}(T)(\\mathbb{E}_{N-1}+\\mathbb{E}_{N}+1)=\\frac{1}{2}(\\mathbb{E}_{N-1}+1)+\\frac{1}{2}(\\mathbb{E}_{N-1}+\\mathbb{E}_{N}+1)\n", 86 | "\\end{equation}\n", 87 | "Multiply by 2 both sides to get \n", 88 | "\\begin{equation}\n", 89 | "\\mathbb{E}_{N}=2\\mathbb{E}_{N-1}+2\n", 90 | "\\end{equation}" 91 | ] 92 | }, 93 | { 94 | "cell_type": "markdown", 95 | "metadata": {}, 96 | "source": [ 97 | "## Python code for simulation" 98 | ] 99 | }, 100 | { 101 | "cell_type": "code", 102 | "execution_count": 1, 103 | "metadata": { 104 | "ExecuteTime": { 105 | "end_time": "2021-03-07T08:53:25.752075Z", 106 | "start_time": "2021-03-07T08:53:25.745380Z" 107 | } 108 | }, 109 | "outputs": [], 110 | "source": [ 111 | "def expect(n):\n", 112 | " if n == 0:\n", 113 | " return 0\n", 114 | "\n", 115 | " return 2*expect(n-1)+2" 116 | ] 117 | }, 118 | { 119 | "cell_type": "code", 120 | "execution_count": 2, 121 | "metadata": { 122 | "ExecuteTime": { 123 | "end_time": "2021-03-07T08:53:31.510661Z", 124 | "start_time": "2021-03-07T08:53:31.488678Z" 125 | } 126 | }, 127 | "outputs": [ 128 | { 129 | "data": { 130 | "text/plain": [ 131 | "6" 132 | ] 133 | }, 134 | "execution_count": 2, 135 | "metadata": {}, 136 | "output_type": "execute_result" 137 | } 138 | ], 139 | "source": [ 140 | "expect(2)" 141 | ] 142 | }, 143 | { 144 | "cell_type": "code", 145 | "execution_count": 3, 146 | "metadata": { 147 | "ExecuteTime": { 148 | "end_time": "2021-03-07T08:53:38.501694Z", 149 | "start_time": "2021-03-07T08:53:38.490798Z" 150 | } 151 | }, 152 | "outputs": [ 153 | { 154 | "data": { 155 | "text/plain": [ 156 | "14" 157 | ] 158 | }, 159 | "execution_count": 3, 160 | "metadata": {}, 161 | "output_type": "execute_result" 162 | } 163 | ], 164 | "source": [ 165 | "expect(3)" 166 | ] 167 | }, 168 | { 169 | "cell_type": "code", 170 | "execution_count": 4, 171 | "metadata": { 172 | "ExecuteTime": { 173 | "end_time": "2021-03-07T08:53:43.391896Z", 174 | "start_time": "2021-03-07T08:53:43.381271Z" 175 | } 176 | }, 177 | "outputs": [ 178 | { 179 | "data": { 180 | "text/plain": [ 181 | "30" 182 | ] 183 | }, 184 | "execution_count": 4, 185 | "metadata": {}, 186 | "output_type": "execute_result" 187 | } 188 | ], 189 | "source": [ 190 | "expect(4)" 191 | ] 192 | }, 193 | { 194 | "cell_type": "code", 195 | "execution_count": 5, 196 | "metadata": { 197 | "ExecuteTime": { 198 | "end_time": "2021-03-07T08:53:49.093149Z", 199 | "start_time": "2021-03-07T08:53:49.080439Z" 200 | } 201 | }, 202 | "outputs": [ 203 | { 204 | "data": { 205 | "text/plain": [ 206 | "62" 207 | ] 208 | }, 209 | "execution_count": 5, 210 | "metadata": {}, 211 | "output_type": "execute_result" 212 | } 213 | ], 214 | "source": [ 215 | "expect(5)" 216 | ] 217 | }, 218 | { 219 | "cell_type": "code", 220 | "execution_count": 6, 221 | "metadata": { 222 | "ExecuteTime": { 223 | "end_time": "2021-03-07T08:53:58.145446Z", 224 | "start_time": "2021-03-07T08:53:58.132668Z" 225 | } 226 | }, 227 | "outputs": [ 228 | { 229 | "data": { 230 | "text/plain": [ 231 | "4094" 232 | ] 233 | }, 234 | "execution_count": 6, 235 | "metadata": {}, 236 | "output_type": "execute_result" 237 | } 238 | ], 239 | "source": [ 240 | "expect(11)" 241 | ] 242 | }, 243 | { 244 | "cell_type": "code", 245 | "execution_count": 7, 246 | "metadata": { 247 | "ExecuteTime": { 248 | "end_time": "2021-03-07T08:54:06.829973Z", 249 | "start_time": "2021-03-07T08:54:06.807643Z" 250 | } 251 | }, 252 | "outputs": [ 253 | { 254 | "data": { 255 | "text/plain": [ 256 | "2535301200456458802993406410750" 257 | ] 258 | }, 259 | "execution_count": 7, 260 | "metadata": {}, 261 | "output_type": "execute_result" 262 | } 263 | ], 264 | "source": [ 265 | "expect(100)" 266 | ] 267 | }, 268 | { 269 | "cell_type": "code", 270 | "execution_count": null, 271 | "metadata": {}, 272 | "outputs": [], 273 | "source": [] 274 | } 275 | ], 276 | "metadata": { 277 | "author": "g", 278 | "hide_input": false, 279 | "kernelspec": { 280 | "display_name": "Python 3", 281 | "language": "python", 282 | "name": "python3" 283 | }, 284 | "language_info": { 285 | "codemirror_mode": { 286 | "name": "ipython", 287 | "version": 3 288 | }, 289 | "file_extension": ".py", 290 | "mimetype": "text/x-python", 291 | "name": "python", 292 | "nbconvert_exporter": "python", 293 | "pygments_lexer": "ipython3", 294 | "version": "3.7.5" 295 | }, 296 | "latex_envs": { 297 | "LaTeX_envs_menu_present": true, 298 | "autoclose": false, 299 | "autocomplete": true, 300 | "bibliofile": "biblio.bib", 301 | "cite_by": "apalike", 302 | "current_citInitial": 1, 303 | "eqLabelWithNumbers": true, 304 | "eqNumInitial": 1, 305 | "hotkeys": { 306 | "equation": "Ctrl-E", 307 | "itemize": "Ctrl-I" 308 | }, 309 | "labels_anchors": false, 310 | "latex_user_defs": false, 311 | "report_style_numbering": false, 312 | "user_envs_cfg": false 313 | } 314 | }, 315 | "nbformat": 4, 316 | "nbformat_minor": 4 317 | } 318 | -------------------------------------------------------------------------------- /Is the coin biased March 10 2021.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "ExecuteTime": { 7 | "end_time": "2021-03-03T15:06:18.500645Z", 8 | "start_time": "2021-03-03T15:06:18.455823Z" 9 | } 10 | }, 11 | "source": [ 12 | "sergazy.nurbavliyev@gmail.com © 2021" 13 | ] 14 | }, 15 | { 16 | "cell_type": "markdown", 17 | "metadata": {}, 18 | "source": [ 19 | "## Is the coin biased?" 20 | ] 21 | }, 22 | { 23 | "cell_type": "markdown", 24 | "metadata": {}, 25 | "source": [ 26 | "Question: A coin is flipped 1000 times and 560 times heads show up. Do you think the coin is biased?\n", 27 | "\n", 28 | "\n", 29 | "https://stats.stackexchange.com/questions/282786/a-job-interview-question-on-flipping-a-coin" 30 | ] 31 | }, 32 | { 33 | "cell_type": "markdown", 34 | "metadata": {}, 35 | "source": [ 36 | "## Answer" 37 | ] 38 | }, 39 | { 40 | "cell_type": "markdown", 41 | "metadata": {}, 42 | "source": [ 43 | "It is already answered pretty nice in the stackexchange website where I give the link above. I would definitely try exactly the same way. \n", 44 | "\n", 45 | "Since the 1000 sample size is large enough, we can apply the Central Limit Theorem. Assume probability of head is $p$ and probability of tails as $q$. Note $p+q=1$. We want to know if $p=1/2$ or not. \n", 46 | "\n", 47 | "Assuming each trial are independent of each other, if $p=1/2$ then we should have expected to see 500 heads.\n", 48 | "and the variance is given by:\n", 49 | "\\begin{equation}\n", 50 | "\\sigma^2= np(1-p)=1000\\frac{1}{2}\\frac{1}{2}=250 \n", 51 | "\\end{equation}\n", 52 | "then the standard deviation would be $\\sqrt{250}=15.81$. Remembering the 68-95-99.7 rule for a Normal Distribution\n", 53 | "we can calculate the z-score for 560 heads:\n", 54 | "\\begin{equation}\n", 55 | "z = \\frac{560-500}{15.81}=3.79\n", 56 | "\\end{equation}\n", 57 | "Remember that 99.7% of the data lies within 3 standard deviation (15.81) of the mean 500. However, we see that here z lies outside of the 99.7%. In other words, if our coin was fair, then probibility of seeing 560 heads is less than 0.03. This means that, most probably our coin is biased coin." 58 | ] 59 | }, 60 | { 61 | "cell_type": "code", 62 | "execution_count": 6, 63 | "metadata": { 64 | "ExecuteTime": { 65 | "end_time": "2021-03-11T05:34:36.267381Z", 66 | "start_time": "2021-03-11T05:34:36.234937Z" 67 | } 68 | }, 69 | "outputs": [ 70 | { 71 | "data": { 72 | "text/plain": [ 73 | "3.794733192202055" 74 | ] 75 | }, 76 | "execution_count": 6, 77 | "metadata": {}, 78 | "output_type": "execute_result" 79 | } 80 | ], 81 | "source": [ 82 | "60/250**(1/2)" 83 | ] 84 | }, 85 | { 86 | "cell_type": "code", 87 | "execution_count": null, 88 | "metadata": {}, 89 | "outputs": [], 90 | "source": [ 91 | "60" 92 | ] 93 | }, 94 | { 95 | "cell_type": "markdown", 96 | "metadata": {}, 97 | "source": [ 98 | "## Python code for simulation" 99 | ] 100 | }, 101 | { 102 | "cell_type": "code", 103 | "execution_count": 45, 104 | "metadata": { 105 | "ExecuteTime": { 106 | "end_time": "2021-03-11T06:06:42.488879Z", 107 | "start_time": "2021-03-11T06:06:40.983592Z" 108 | } 109 | }, 110 | "outputs": [], 111 | "source": [ 112 | "import random\n", 113 | "trial_list= [sum([random.randint(0,1) for i in range(1000)]) for j in range(1000)]" 114 | ] 115 | }, 116 | { 117 | "cell_type": "code", 118 | "execution_count": 46, 119 | "metadata": { 120 | "ExecuteTime": { 121 | "end_time": "2021-03-11T06:06:43.395435Z", 122 | "start_time": "2021-03-11T06:06:43.223981Z" 123 | } 124 | }, 125 | "outputs": [ 126 | { 127 | "data": { 128 | "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD4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ADhbtQxNWXM/DsAyxtgKxlgtgGcBTMxxmWKBMbaRMfa59fceAAuR6hgTkRIGsP6/wPp7IoBnGWM1jLGVAJYhVT9NBiIqBzABwOPc4YJ9XgAgovZICYEnAIAxVssY24nCfu4SAK2IqARAawAbUIDPyxibAWC767DWcxJRLwDtGWMfs5Skf4q7J5CmLNz7AFjL/V5nHSsoiKgCwDEAPgHQgzG2EUh9AAB0ty4rhLr4HYBbADRyxwr5eYHUqHMLgL9Y5qjHiagNCvS5GWPrAdwPYA2AjQB2McbeRoE+rwDd5+xj/e0+rkRTFu4i21NB+XUSUVsAzwP4AWNst9+lgmNNpi6I6FwA1YyxWaq3CI41meflKEFq6P4nxtgxAPYhNVyX0aSf27IxT0TK9NAbQBsiutTvFsGxJvO8GsieM9LzN2Xhvg4Av/16OVJDvIKAiEqREuxPM8ZesA5vtoZqsP6vto439boYA+B8IlqFlHntNCL6Bwr3eW3WAVjHGPvE+v0fpIR9oT73GQBWMsa2MMbqALwAYDQK93nd6D7nOutv93ElmrJw/wzAACLqR0QtAEwC8EqOyxQL1oz4EwAWMsYe5E69AuBy6+/LAbzMHZ9ERGVE1A/AAKQmYpoEjLHJjLFyxlgFUu/xPcbYpSjQ57VhjG0CsJaIjrAOnQ5gAQr3udcAGEVEra02fjpS80mF+rxutJ7TMt3sIaJRVn19k7snmFzPKkeckT4HKU+S5QBuy3V5YnyuE5Eafn0BYI717xwAXQC8C2Cp9X9n7p7brHpYDI0Z9Xz7B+AUZLxlmsPzDgdQZb3rlwB0KuTnBnAngEUA5gP4O1IeIgX3vAD+idS8Qh1SGviVYZ4TQKVVV8sBPAwrqoDKPxN+wGAwGAqQpmyWMRgMBoMEI9wNBoOhADHC3WAwGAoQI9wNBoOhADHC3WAwGAoQI9wNBoOhADHC3WAwGAqQ/w8fCjsjTiDZawAAAABJRU5ErkJggg==\n", 129 | "text/plain": [ 130 | "
" 131 | ] 132 | }, 133 | "metadata": { 134 | "needs_background": "light" 135 | }, 136 | "output_type": "display_data" 137 | } 138 | ], 139 | "source": [ 140 | "from matplotlib import pyplot as plt\n", 141 | "plt.plot(trial_list)\n", 142 | "plt.axhline(y=560, color='r', linestyle='-')\n", 143 | "plt.show()" 144 | ] 145 | }, 146 | { 147 | "cell_type": "code", 148 | "execution_count": null, 149 | "metadata": {}, 150 | "outputs": [], 151 | "source": [] 152 | }, 153 | { 154 | "cell_type": "code", 155 | "execution_count": null, 156 | "metadata": {}, 157 | "outputs": [], 158 | "source": [] 159 | } 160 | ], 161 | "metadata": { 162 | "author": "g", 163 | "hide_input": false, 164 | "kernelspec": { 165 | "display_name": "Python 3", 166 | "language": "python", 167 | "name": "python3" 168 | }, 169 | "language_info": { 170 | "codemirror_mode": { 171 | "name": "ipython", 172 | "version": 3 173 | }, 174 | "file_extension": ".py", 175 | "mimetype": "text/x-python", 176 | "name": "python", 177 | "nbconvert_exporter": "python", 178 | "pygments_lexer": "ipython3", 179 | "version": "3.7.5" 180 | }, 181 | "latex_envs": { 182 | "LaTeX_envs_menu_present": true, 183 | "autoclose": false, 184 | "autocomplete": true, 185 | "bibliofile": "biblio.bib", 186 | "cite_by": "apalike", 187 | "current_citInitial": 1, 188 | "eqLabelWithNumbers": true, 189 | "eqNumInitial": 1, 190 | "hotkeys": { 191 | "equation": "Ctrl-E", 192 | "itemize": "Ctrl-I" 193 | }, 194 | "labels_anchors": false, 195 | "latex_user_defs": false, 196 | "report_style_numbering": false, 197 | "user_envs_cfg": false 198 | } 199 | }, 200 | "nbformat": 4, 201 | "nbformat_minor": 4 202 | } 203 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Sergazy Nurbavliyev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Minimim of two random variables March 3 2021.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "ExecuteTime": { 7 | "end_time": "2021-03-03T15:06:18.500645Z", 8 | "start_time": "2021-03-03T15:06:18.455823Z" 9 | } 10 | }, 11 | "source": [ 12 | "sergazy.nurbavliyev@gmail.com © 2021" 13 | ] 14 | }, 15 | { 16 | "cell_type": "markdown", 17 | "metadata": {}, 18 | "source": [ 19 | "## Minimum of two random variables" 20 | ] 21 | }, 22 | { 23 | "cell_type": "markdown", 24 | "metadata": {}, 25 | "source": [ 26 | "Question: Assume we have $X \\sim Uniform(0, 1)$ and $Y \\sim Uniform(0,1)$ and independent of each other. What is the expected value of the minimum of $X$ and $Y$?\n" 27 | ] 28 | }, 29 | { 30 | "cell_type": "markdown", 31 | "metadata": {}, 32 | "source": [ 33 | "### Intuition" 34 | ] 35 | }, 36 | { 37 | "cell_type": "markdown", 38 | "metadata": {}, 39 | "source": [ 40 | "Before going to show the exact theoretical result, we can think heuristically,we have two uniform random variables that are independent of each other, we would expect two of these random variables to divide the interval (0,1) equally into 3 equal subintervals. Then the minimum would occur at 1/3 and the other one (which is maximum in this case) occurs at 2/3. We can even generalize our intuition for $n$ independent uniform random variables. In that case minimum would occur at $1/(n+1)$ and maximum would occur at $n/(n+1)$. Now let us verify intution theoretically. " 41 | ] 42 | }, 43 | { 44 | "cell_type": "markdown", 45 | "metadata": {}, 46 | "source": [ 47 | "### Theoritical result" 48 | ] 49 | }, 50 | { 51 | "cell_type": "markdown", 52 | "metadata": {}, 53 | "source": [ 54 | "Let $Z$ be minimum of X and Y. We write this as $Z=\\min(X,Y)$. \n", 55 | "\\begin{equation}\n", 56 | "\\mathbb{P}(Z\\leq z)= \\mathbb{P}(\\min(X,Y)\\leq z) =1-\\mathbb{P}(\\min(X,Y)\\geq z)=1-\\mathbb{P}(X> z, Y>z)\n", 57 | "\\end{equation}\n", 58 | "Since our distribution is between 0 and 1 the following is true for uniform distribution\n", 59 | "\\begin{equation}\n", 60 | "\\mathbb{P}(X\\leq z)= z \\text{ and } \\mathbb{P}(X> z)=1- z \n", 61 | "\\end{equation}\n", 62 | "Also same goes for $Y$. Now since they are independent we have\n", 63 | "\\begin{equation}\n", 64 | "\\mathbb{P}(X> z, Y>z)=\\mathbb{P}(X> z)\\mathbb{P}(Y>z)=(1-z)^{2}\n", 65 | "\\end{equation}\n", 66 | "Then equation (1) becomes\n", 67 | "\\begin{equation}\n", 68 | "\\mathbb{P}(Z\\leq z)=1-\\mathbb{P}(X> z, Y>z)=1-(1-z)^{2}\n", 69 | "\\end{equation}\n", 70 | "We just calculated cumulative distribution function of $z$. Usually denoted as \n", 71 | "\\begin{equation}\n", 72 | "F_{Z}(z)= \\mathbb{P}(Z\\leq z)\n", 73 | "\\end{equation}\n", 74 | "If we take derivative of this $ F_{Z}(z)$, we will get density function of z. In this case it would be\n", 75 | "\\begin{equation}\n", 76 | "F_{Z}'(z)=f_Z(z)=2(1-z)\n", 77 | "\\end{equation}\n", 78 | "As last part we would take integral of $zf_Z(z)$ between 0 and 1 to find an expected value of minimum of two uniform random variables.\n", 79 | "\\begin{equation}\n", 80 | "\\mathbb{E}[Z]=\\int_{0}^1 zf_Z(z)dz=\\int_{0}^1 2z(1-z)dz=2\\left(\\frac{1}{2}-\\frac{1}{3}\\right)=\\frac{1}{3}\n", 81 | "\\end{equation}" 82 | ] 83 | }, 84 | { 85 | "cell_type": "code", 86 | "execution_count": 35, 87 | "metadata": { 88 | "ExecuteTime": { 89 | "end_time": "2021-03-03T17:11:24.658749Z", 90 | "start_time": "2021-03-03T17:11:24.610712Z" 91 | } 92 | }, 93 | "outputs": [], 94 | "source": [ 95 | "# If you are allowed to use any programming language then you can simulate.\n", 96 | "import numpy as np\n", 97 | "x = np.random.uniform(0,1,100000)\n", 98 | "y = np.random.uniform(0,1,100000)\n", 99 | "z =np.minimum(x,y)\n", 100 | "u =np.maximum(x,y)" 101 | ] 102 | }, 103 | { 104 | "cell_type": "code", 105 | "execution_count": 40, 106 | "metadata": { 107 | "ExecuteTime": { 108 | "end_time": "2021-03-03T17:11:55.696036Z", 109 | "start_time": "2021-03-03T17:11:55.677315Z" 110 | } 111 | }, 112 | "outputs": [ 113 | { 114 | "data": { 115 | "text/plain": [ 116 | "(0.33389155844548174, 0.6670118602826249)" 117 | ] 118 | }, 119 | "execution_count": 40, 120 | "metadata": {}, 121 | "output_type": "execute_result" 122 | } 123 | ], 124 | "source": [ 125 | "np.mean(z), np.mean(u) # as you can see z is very close to 1/3" 126 | ] 127 | }, 128 | { 129 | "cell_type": "markdown", 130 | "metadata": {}, 131 | "source": [ 132 | "### To see the histogram of Z and U" 133 | ] 134 | }, 135 | { 136 | "cell_type": "code", 137 | "execution_count": 37, 138 | "metadata": { 139 | "ExecuteTime": { 140 | "end_time": "2021-03-03T17:11:26.933320Z", 141 | "start_time": "2021-03-03T17:11:26.140630Z" 142 | } 143 | }, 144 | "outputs": [ 145 | { 146 | "data": { 147 | "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAD8CAYAAABw1c+bAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t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tyYzxLHo+v/7par6GfCzJCeAa4BpDfxd5nwLcGf1CuBnkvwI+C3g/0xmiBM31hg2jaWetdxCYlotO+ckM8ADwKemOPMbtOycq+rqqtpVVbuAPwH+zZQHfej2//tPgX+c5LIkbwOuBZ6b8DhHqcuc/4reNxySXAn8PeDsREc5WWONYVOX8dcabiExrTrO+Xbg3cBX+xnwQk3xza06znnT6TLvqnouyUPA08DfAPdU1ZLLAqdBx7/1fwLuTfJ9emWQL1bV1N61M8l9wA3AtiTzwB3A5TCZGOaVu5LUmGks9UiS1sDAL0mNMfBLUmMM/JLUGAO/JDXGwC9JjTHwS1JjDPyS1Jj/D/C4lBQEDeP6AAAAAElFTkSuQmCC\n", 148 | "text/plain": [ 149 | "
" 150 | ] 151 | }, 152 | "metadata": { 153 | "needs_background": "light" 154 | }, 155 | "output_type": "display_data" 156 | } 157 | ], 158 | "source": [ 159 | "import matplotlib.pyplot as plt\n", 160 | "count, bins, ignored = plt.hist(z, 100, density=True)\n", 161 | "plt.plot(bins, np.ones_like(bins), linewidth=2, color='r')\n", 162 | "plt.show()" 163 | ] 164 | }, 165 | { 166 | "cell_type": "code", 167 | "execution_count": 38, 168 | "metadata": { 169 | "ExecuteTime": { 170 | "end_time": "2021-03-03T17:11:28.488465Z", 171 | "start_time": "2021-03-03T17:11:26.943898Z" 172 | } 173 | }, 174 | "outputs": [ 175 | { 176 | "data": { 177 | "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAD8CAYAAABw1c+bAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi41LCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvSM8oowAAE2pJREFUeJzt3X+sXGed3/H3Z51EKiyCLU6yyM7FaeVt8a4IpbcO29CStII6WZCFxB82iNVGoCsorrZVuyLdP4jE/gNCqrooActKrQipxH+UBFzV5IfUdk03zW4clF9OCLpr0s3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VuqRJK2TwS9JjTH4JakxBr8kNcbgl6TGGPyS1BiDX5IaY/BLUmP+P3UvQcO6B+4YAAAAAElFTkSuQmCC\n", 178 | "text/plain": [ 179 | "
" 180 | ] 181 | }, 182 | "metadata": { 183 | "needs_background": "light" 184 | }, 185 | "output_type": "display_data" 186 | } 187 | ], 188 | "source": [ 189 | "import matplotlib.pyplot as plt\n", 190 | "count, bins, ignored = plt.hist(u, 100, density=True)\n", 191 | "plt.plot(bins, np.ones_like(bins), linewidth=2, color='r')\n", 192 | "plt.show()" 193 | ] 194 | }, 195 | { 196 | "cell_type": "code", 197 | "execution_count": null, 198 | "metadata": {}, 199 | "outputs": [], 200 | "source": [] 201 | }, 202 | { 203 | "cell_type": "code", 204 | "execution_count": null, 205 | "metadata": {}, 206 | "outputs": [], 207 | "source": [] 208 | } 209 | ], 210 | "metadata": { 211 | "author": "g", 212 | "hide_input": false, 213 | "kernelspec": { 214 | "display_name": "Python 3", 215 | "language": "python", 216 | "name": "python3" 217 | }, 218 | "language_info": { 219 | "codemirror_mode": { 220 | "name": "ipython", 221 | "version": 3 222 | }, 223 | "file_extension": ".py", 224 | "mimetype": "text/x-python", 225 | "name": "python", 226 | "nbconvert_exporter": "python", 227 | "pygments_lexer": "ipython3", 228 | "version": "3.7.5" 229 | }, 230 | "latex_envs": { 231 | "LaTeX_envs_menu_present": true, 232 | "autoclose": false, 233 | "autocomplete": true, 234 | "bibliofile": "biblio.bib", 235 | "cite_by": "apalike", 236 | "current_citInitial": 1, 237 | "eqLabelWithNumbers": true, 238 | "eqNumInitial": 1, 239 | "hotkeys": { 240 | "equation": "Ctrl-E", 241 | "itemize": "Ctrl-I" 242 | }, 243 | "labels_anchors": false, 244 | "latex_user_defs": false, 245 | "report_style_numbering": false, 246 | "user_envs_cfg": false 247 | } 248 | }, 249 | "nbformat": 4, 250 | "nbformat_minor": 4 251 | } 252 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Repo name is probability_stats_interveiw_questions, but it includes all ML, SQL and product questions as well. 2 | Screen Shot 2021-03-05 at 2 59 24 PM 3 | 4 | 5 | In this repository, I will try to solve interview questions that are mostly about probability theory, statistics, ML/DL/RL, SQL and Products and mostly asked by FAANGM(T) and some other big companies. 6 | 1. Minimum of two uniform random variables 7 | 2. Detecting Unfair coin 8 | 3. Can you form a triangle ? 9 | 4. Expected Number of flips until N heads 10 | 5. Simulating a Fair Coin with a Biased Coin 11 | 6. Which game you would choose? 12 | 7. Is the coin biased? 13 | 8. Fair coins and double headed coin 14 | 15 | ## Probability 16 | #### Difficulties: Easy, Medium, Hard, Extremely Hard. 17 | 1. Minimum of two uniform random variables: 18 | 19 | This problem was asked by Google. Probability, Medium 20 | 21 | Say we have X ~ Uniform(0, 1) and Y ~ Uniform(0, 1). What is the expected value of the minimum of X and Y? 22 | 23 | 2. Is this coin biased ? 24 | 25 | This problem was asked by Google. Probability, Medium. 26 | 27 | A coin was flipped 1000 times, and 550 times it showed heads. Do you think the coin is biased? Why or why not? 28 | 29 | 3. Forming a triangle 30 | 31 | This problem was asked by Google. Probability, Medium. 32 | 33 | Assume you have a stick of length 1 and you break it uniformly at random into three parts. What is the probability that the three parts form a triangle? 34 | 35 | 4. Flip until 2 heads 36 | 37 | This problem was asked by Lyft. Probability, Medium. 38 | 39 | What is the expected number of coin flips needed to get two consecutive heads? 40 | 41 | 42 | 5. Fair odds from unfair coin 43 | 44 | This problem was asked by Airbnb. Probability, Medium. 45 | 46 | Say you are given an unfair coin, with an unknown bias towards heads or tails. How can you generate fair odds using this coin? 47 | 48 | 49 | 50 | 6. Ant collision 51 | 52 | This problem was asked by Facebook. Probability, Medium. 53 | 54 | Three ants are sitting at the corners of an equilateral triangle. Each ant randomly picks a direction and starts moving along the edge of the triangle. What is the probability that none of the ants collide? Now, what if it is k ants on all k corners of an equilateral polygon? 55 | 56 | 57 | 7. Number of cards before an Ace 58 | 59 | This problem was asked by Lyft. Probability, Medium. 60 | 61 | How many cards would you expect to draw from a standard deck before seeing the first ace? 62 | 63 | 8. First to roll side K 64 | 65 | This problem was asked by Lyft. Probability, Medium. 66 | 67 | A and B are playing the following game: a number k from 1-6 is chosen, and A and B will toss a die until the first person sees the side k, and that person gets $100. How much is A willing to pay to play first in this game? 68 | 69 | 9. Flipping game 70 | 71 | This problem was asked by Facebook. Probability, Easy. 72 | 73 | You and your friend are playing a game. The two of you will continue to toss a coin until the sequence HH or TH shows up. If HH shows up first, you win. If TH shows up first, your friend wins. What is the probability of you winning? 74 | 75 | 10. Labeling content 76 | 77 | This problem was asked by Facebook. Probability, Easy. 78 | 79 | Facebook has a content team that labels pieces of content on the platform as spam or not spam. 90% of them are diligent raters and will label 20% of the content as spam and 80% as non-spam. The remaining 10% are non-diligent raters and will label 0% of the content as spam and 100% as non-spam. Assume the pieces of content are labeled independently from one another, for every rater. Given that a rater has labeled 4 pieces of content as good, what is the probability that they are a diligent rater? 80 | 11. Max dice roll 81 | 82 | This problem was asked by Spotify. Probability, Medium. 83 | 84 | A fair die is rolled n times. What is the probability that the largest number rolled is r, for each r in 1..6? 85 | 86 | 12. Mutual best friends 87 | 88 | This problem was asked by Snapchat. Probability, Hard. 89 | 90 | There are two groups of n Snapchat users, A and B, and each user in A is friends with those in B and vice versa. Each user in A will randomly choose a user in B as their best friend and each user in B will randomly choose a user in A as their best friend. If two people have chosen each other, they are mutual best friends. What is the probability that there will be no mutual best friendships? 91 | 92 | 13. Increase dice order 93 | 94 | This problem was asked by Uber. Probability, Medium. 95 | 96 | Say you roll three dice, one by one. What is the probability that you obtain 3 numbers in a strictly increasing order? 97 | 98 | 14. First toss 99 | 100 | This problem was asked by Lyft. Probability, Medium. 101 | 102 | A fair coin is tossed n times. Given that there were k heads in the n tosses, what is the probability that the first toss was heads? 103 | 104 | 105 | 15. Coin recursion 106 | 107 | This problem was asked by Robinhood. Probability, Medium 108 | A biased coin, with probability p of landing on heads, is tossed n times. Write a recurrence relation for the probability that the total number of heads after n tosses is even. 109 | 110 | 16. Random testing 111 | 112 | This problem was asked by Lyft. Probability, Easy. 113 | 114 | Say that you are pushing a new feature X out. You have 1000 users and each user is either a fan or not a fan of X, at random. There are 50 users out of 1000 that do not like X. You will decide whether to ship the feature or not, based on sampling 5 users independently and if they all like the feature, you will ship it. What is the probability that you will ship the feature? 115 | 116 | 17. Game series 117 | 118 | This problem was asked by Facebook. Probability, Medium. 119 | 120 | Alice and Bob are playing a new Facebook game together. They play a series of rounds until one of them wins two more rounds than the other. With probability p, Alice will win each round. What is the probability that Bob wins the overall series? 121 | 122 | 18. User virality 123 | 124 | This problem was asked by Snapchat. Probability, Medium 125 | 126 | You are analyzing the probability of failure or success of a small social media app competitor. Using some initial data, you estimate that at any step, if there is 1 user then after a day there is a 1/12 chance there will be 0 users, 5/12 chance there will be 1 user, and 1/2 chance there will be 2 users. Say the app starts with one user on day 1. What is the probability that the app will eventually have no users? 127 | 128 | 19. Replacement frequence. 129 | 130 | This problem was asked by Tesla. Probability, Hard. 131 | 132 | Suppose there is a new vehicle launch upcoming. Initial data suggests that any given day there is either a malfunction with some part of the vehicle or possibility of a crash, with probability p which then requires a replacement. Additionally, each vehicle that has been around for n days must be replaced. What is the long-term frequency of vehicle replacements? 133 | 134 | 135 | 20. Favorite show 136 | 137 | This problem was asked by Disney. Probability, Medium 138 | 139 | Alice and Bob are choosing their top 3 shows from a list of 50 shows. Assume that they choose independently of one another. Being relatively new to Hulu, assume also that they choose randomly within the 50 shows. What is the expected number of shows they have in common, and what is the probability that they do not have any shows in common? 140 | 21. Different Dice rolls 141 | 142 | This problem was asked by Facebook. Probability, Easy. 143 | 144 | Say you roll three dice and observe the sum of the three rolls. What is the probability that the sum of the outcomes is 12, given that the three rolls are different? 145 | 146 | 22. Mean roll times 147 | 148 | This problem was asked by Lyft. Probability, Medium 149 | 150 | Suppose you roll a fair die n times, where n is very large. What is the average time between occurrences of a given number? 151 | 23. Fan groups 152 | 153 | This problem was asked by Snapchat. Probability, Easy. 154 | 155 | You are testing a new feature with various sample groups of three people. Assume that each person is equally likely to be a fan or not a fan of the feature. What is the probability that a randomly chosen group has exactly one fan, given that there is a fan among the three? 156 | 24. Waiting time 157 | 158 | This problem was asked by Twilio. Probability, Easy. 159 | 160 | You are modeling the wait time a customer has for a support call as exponentially distributed with a mean of 10 minutes. Suppose a customer calls in and is told that all lines are currently busy, and the most recent last spot was occupied 5 minutes ago. What is the probability that the current customer will need to wait no more than another 5 minutes? 161 | 162 | 163 | 164 | 25. Hit shows 165 | 166 | This problem was asked by Netflix. Probability, Hard. 167 | 168 | Before a show is released, it is shown to several in-house raters. You assume there are two types of shows: hits, which have an 80% chance of being liked by any viewer, and misses, which have a 20% chance of being liked by any viewer. There is currently a new show which you believe has a prior distribution of 60% being a hit, and 40% being a miss. Given that 8 raters rated the show and 6 of the 8 liked the show, what is the new posterior distribution of being a hit or miss? 169 | 26. Random groups 170 | 171 | This problem was asked by Snapchat. Probability, Easy. 172 | 173 | Say we have M users and N groups that we want to assign users into. Define a group as having at least one or more users. How many N-user groups can be made using the M users? 174 | 175 | 27. First to pick 176 | 177 | This problem was asked by Facebook. Probability, Medium. 178 | 179 | Two people are picking random numbers among a set of M odd numbers and N even numbers without replacement. The first person to pick an even number wins. What is the probability that the first person who picks wins? 180 | 181 | 28. API availability 182 | 183 | This problem was asked by Twilio. Probability, Easy. 184 | 185 | Say we have N servers running to serve APIs, each of which has an uptime with probability p at any given time. Assume each server is up independently of other servers. A customer will always get an eventually valid API response if there are at least M of the N servers up. What is the probability that at any given time, a customer will not get an eventually valid API response? 186 | 187 | 188 | 189 | 29. Card colors 190 | 191 | This problem was asked by Facebook. Probability, Easy. 192 | 193 | Say you have a deck of 50 cards with 5 different colors, and 10 cards of each color. What is the probability that two cards you pick at random do not have the same color and are also not the same number? 194 | 30. Default time 195 | 196 | This problem was asked by Stripe. Probability, Easy. 197 | 198 | You are modeling time until default as an exponentially distributed random variable on a weekly basis. Say you have a given customer where you determine their chance of default within the next week is 0.4. What is that customer's probability of default within the next two weeks? 199 | 200 | 31. Monthly actives 201 | 202 | This problem was asked by Snapchat. Probability, Easy. 203 | 204 | Say you are analyzing the current set of monthly active users (MAUs). Suppose that if a user is currently a MAU, then the probability they will be a MAU next month is 0.9. Additionally, if a user is not currently a MAU then the probability that they will not be one next month is 0.7. In the long fraction what fraction of the current MAUs will still be MAUs? 205 | 206 | 32. Back and forth 207 | 208 | This problem was asked by Lyft. Probability, Easy. 209 | A and B are playing a game where they take turns flipping a biased coin, with the probability of landing on heads (and winning) as p. Player A starts the game and they pass the coin back and forth until one person flips heads and wins. What is the probability that A wins? 210 | 211 | 33. Filtering normal 212 | 213 | This problem was asked by Quora. Probability, Medium. 214 | 215 | Say you have N i.i.d. draws of a normal distribution with parameters μ and σ. What is the probability that k of those draws are larger than some value Y? 216 | 217 | 218 | 34. More likely outcome 219 | 220 | This problem was asked by Uber. Probability, medium 221 | 222 | A fair coin is tossed twice, and you have to decide whether it is more likely that two heads showed up given that either a) at least one toss was heads, and b) the second toss was heads. Does your answer change if the coin is unfair? 223 | 224 | 225 | 35. Full delivery 226 | 227 | This problem was asked by DoorDash. Probability, Medium. 228 | 229 | There are n of the same meals to be delivered at k delivery spots. Each meal is assigned a delivery spot at random, and the delivery driver will only stop at a delivery spot if there is a meal to be delivered there. What is the probability that the delivery driver will make a full k stops? 230 | 231 | 36. User threshold 232 | 233 | This problem was asked by Snapchat. Probability, Medium. 234 | 235 | Suppose that you are monitoring the number of daily active users (DAUs) on a daily basis. You determine that on any given day, that population follows a binomial random variable with a certain mean and variance and the population on each day is independent of other days. You set an alert threshold for this week whereby you want to be notified if the population falls below 0.9 * its mean. What is the probability that your alert will go off? 236 | 237 | 37. Empty topic 238 | 239 | This problem was asked by Twitter. Probability, Medium. 240 | 241 | There are n users and there are k topics. Assume that they select independently, and select a topic completely at random. What is the probability that exactly one topic will have nobody choosing it? 242 | 243 | 244 | 245 | 246 | 38. Political groups 247 | 248 | This problem was asked by Twitter. Probability, Medium. 249 | 250 | Say you have a large group of people, each is affiliated as either a Republican or a Democrat. Specifically, there are k groups and each group has R Republicans and D Democrats. At random, a person from group 1 is chosen and sent to group 2, then a person from group 2 is chosen and sent to group 3, etc. Finally, a random person is chosen from group k. What is the probability that the given person is a Republican? 251 | 252 | 39. Dice re-roll 253 | 254 | This problem was asked by JP Morgan. Probability, Easy. 255 | 256 | Say you are playing a game where you roll a 6-sided dice up to two times, where you can choose to stop at the end of first roll if you wish. You will get a dollar amount equal to the final rolled amount. How much are you willing to pay to play this game? 257 | 258 | 40. Going to 7. 259 | 260 | This problem was asked by Google. Probability, Easy. 261 | 262 | Say that two teams are playing a series in which each team has a 50% chance of winning any given round. What is the probability that the series will go to 7 games? 263 | 264 | 41. Gender guess 265 | 266 | This problem was asked by D.E. Shaw. Probability, Easy. 267 | 268 | Suppose you call a random person and ask if they have two children. The person says yes they have two children. You find out that one of their children is a boy - what is the probability that the second child is also a boy? 269 | 270 | 42. Chance of rain 271 | This problem was asked by Microsoft. Probability, easy 272 | Three friends in Seattle each told you it’s rainy, and each person has a 1/3 probability of lying. What is the probability that Seattle is rainy? Assume the probability of rain on any given day is 0.25. 273 | 274 | 275 | 276 | 41. Amoeba Survival 277 | 278 | This problem was asked by Goldman Sachs. Probability, easy 279 | Say you have a jar and it has a single amoeba in it to begin. At every minute, the amoeba has a 1 in 4 chance of doing one of four things: 1) dying out, 2) doing nothing, 3) splitting into 2. What is the probability that there will no amoeba eventually? 280 | 42. Counting paths 281 | This problem was asked by JP Morgan. Probability, easy 282 | Imagine you are in a 3D space. From (0,0,0) to (3,3,3), how many paths are there if you can only move up, right, and forward? 283 | 284 | 43. User transition 285 | This problem was asked by Pinterest. Probability, easy 286 | Suppose that you are modeling the monthly active status of a user. At every month, with probability p if the user was a monthly active, then the user will not monthly active user the next month. What is the probability that an arbitrary user will be a monthly active user after two months? 287 | 288 | 44. Subsequence chance. 289 | 290 | This problem was asked by Lyft. Probability, medium 291 | What is the probability that in a random sequence of H's and T's that HHT shows up before HTT? 292 | 293 | 45. Double draw 294 | 295 | This problem was asked by Zenefits. Probability, easy 296 | Say that you have a deck of 100 cards with values from 1 to 100, and draw two cards at random without replacement. What is the probability that one card is exactly double the other? 297 | 298 | 299 | 46. Consecutive sixes 300 | 301 | This problem was asked by JP Morgan. Probability, easy 302 | Say you roll a dice three times. What is the probability of getting two sixes in a row? 303 | 304 | 47. Colored Cubes 305 | 306 | This problem was asked by SIG. Probability, medium 307 | Suppose you are given a white cube that is broken into 3x3x3 = 27 pieces. However, before doing so, all 6 faces of the cube were painted green. You randomly pick a small cube and see that 5 faces are white. What is the probability that the bottom face is also white? 308 | 309 | 48. Random drawer 310 | 311 | This problem was asked by J.P. Morgan. Probability, easy 312 | There are 8 drawers. With probability 1/2, somebody put a letter in one of the drawers. With probability 1/2, that person did not don't put a letter in any drawer. You open the first 7 drawers, and find that they are all empty. What is the probability the 8th drawer has a letter in it? 313 | 314 | 315 | ## Statistics 316 | 317 | 318 | 1. Unfair Coin: 319 | This problem was asked by Facebook. Statistics, Medium 320 | 321 | There is a fair coin (one side heads, one side tails) and an unfair coin (both sides tails). 322 | You pick one at random, flip it 5 times, and observe that it comes up as tails all five times. What is the chance that you are flipping the unfair coin? 323 | 324 | 2. Ranking List of shows: 325 | 326 | This problem was asked by Netflix. Product/Statistics, Medium 327 | How would you design a metric to compare rankings of lists of shows for a given user? 328 | 329 | 3. Unbaised and consistency 330 | This problem was asked by Google. Statistics 331 | What does it mean for an estimator to be unbiased? What about consistent? Give examples of an unbiased but not consistent estimator, as well as a biased but consistent estimator. 332 | 333 | 4. p-value 334 | 335 | This problem was asked by Airbnb. Statistics 336 | 337 | How can you decide how long to run an experiment? What are some problems with just using a fixed p-value threshold and how do you work around them? 338 | 339 | 340 | 5. Picking between two dice games 341 | This problem was asked by Facebook., Statistics, hard 342 | There are two games involving dice that you can play. In the first game, you roll two die at once and get the dollar amount equivalent to the product of the rolls. In the second game, you roll one die and get the dollar amount equivalent to the square of that value. Which has the higher expected value and why? 343 | 344 | 345 | 6. Correlated predictors 346 | 347 | This problem was asked by Google. Statistics , medium 348 | Say you are running a multiple linear regression and believe there are several predictors that are correlated. How will the results of the regression be affected if they are indeed correlated? How would you deal with this problem? 349 | 350 | 7. MLE vs MAP 351 | 352 | This problem was asked by Netflix. Statistics, hard. 353 | What are MLE and MAP? What is the difference between the two? 354 | 355 | 8. Improving signups 356 | 357 | This problem was asked by Quora. Product/statistics, easy 358 | Assume you want to test whether a new feature increases signups to the site. How would you run this experiment? What statistical test(s) would you use? 359 | 360 | 9. Independent and uncorrelated. 361 | 362 | This problem was asked by Stripe. Statistics hard 363 | Say we have two random variables X and Y. What does it mean for X and Y to be independent? What about uncorrelated? Give an example where X and Y are uncorrelated but not independent. 364 | 365 | 10. A/B testing in streaming 366 | 367 | This problem was asked by Netflix. Product/statistics, medium, 368 | In the streaming context, for A/B testing, what are some metrics and data to track, and what are some differences versus more traditional A/B testing? 369 | 370 | 371 | 372 | 373 | 11. One extra coin toss 374 | This problem was asked by Robinhood. Statistics, Medium 375 | A and B are playing a game where A has n+1 coins, B has n coins, and they each flip all of their coins. What is the probability that A will have more heads than B? 376 | 377 | 12. Linear regression assumptions 378 | 379 | This problem was asked by Google. Statistics, easy 380 | What are the assumptions behind linear regression? How do you diagnose if any of these assumptions are violated? 381 | 382 | 13. Covariance of uniforms 383 | This problem was asked by Netflix. Statistics, hard 384 | Say we have X ~ Uniform(-1, 1) and Y = X^2. What is the covariance of X and Y? 385 | 386 | 14. Coin flips needed to detect bias 387 | This problem was asked by Lyft. Statistics, medium 388 | Say you have an unfair coin which will land on heads 60% of the time. How many coin flips are needed to detect that the coin is unfair? 389 | 390 | 15. Area of the circle 391 | This problem was asked by Lyft. Statistics , medium 392 | Say you pick the radius of a circle from a uniform distribution between 0 and 1. What is the probability density of the area of the resulting circle? 393 | 394 | 395 | 16. Customer churn MLE 396 | 397 | This problem was asked by Airbnb. Statistics, medium 398 | Say you model the lifetime for a set of customers using an exponential distribution with parameter λ, and you have the lifetime history (in months) of n customers. What is the MLE for λ? 399 | 17. Server wait time 400 | This problem was asked by Dropbox. Statistics, Medium 401 | Dropbox has just started and there are two servers that service users: a faster server and a slower server. When a user is on the website, they are routed to either server randomly, and the wait time is exponentially distributed with two different parameters. What is the probability density of a random user's waiting time? 402 | 403 | 18. Clicking variances 404 | This problem was asked by Google. Statistics, easy, 405 | Say you have two countries of interest and want to compare variances of clicking behavior from users (i.e. total distribution of clicks). How would you do this comparison, and what assumptions need to be met? 406 | 407 | 19. Uncorrelated condition 408 | 409 | This problem was asked by Airbnb. Statistics, medium 410 | Suppose we have two random variables X and Y. Under what condition are X+Y and X-Y uncorrelated? 411 | 82. Bernoulli samples 412 | This problem was asked by Stripe. Statistics, medium 413 | Consider a Bernoulli random variable with parameter p. Say you observe the following samples: [1, 0, 1, 1, 1]. What is the log likelihood function for p and what is the MLE of p? 414 | 415 | 20. Bernoulli samples 416 | This problem was asked by Stripe. Statistics, medium 417 | Consider a Bernoulli random variable with parameter p. Say you observe the following samples: [1, 0, 1, 1, 1]. What is the log likelihood function for p and what is the MLE of p? 418 | 419 | 420 | 421 | 422 | 20. Minimum dice roll 423 | 424 | This problem was asked by Uber. Stats, hard, 425 | A fair die is rolled n times. What is the expected value and the standard deviation of the smallest number rolled? 426 | 427 | 21. expected swaps 428 | 429 | This problem was asked by Robinhood. Stats medium 430 | Say you have n integers 1...n and take a random permutation. For any integers i, j let a swap be defined as when the integer i is in the jth position, and vice versa. What is the expected value of the total number of swaps? 431 | 432 | 22. Lifetime likelihood 433 | This problem was asked by Snapchat. Stats, medium 434 | Say you have a large amount of user data that measures the lifetime of each user. Assume you model each lifetime as exponentially distributed random variables. What is the likelihood ratio for assessing two potential λ values, one from the null hypothesis and the other from the alternative hypothesis? 435 | 23. Lifetime difference 436 | 437 | This problem was asked by Tesla. Stats medium 438 | Say that the lifetime of electric vehicles are modeled using a Gaussian distribution. Each type of electric vehicle has an expected lifetime and a lifetime variance. Say you chose two different types of electric vehicles at random. What is the probability that the two lifetimes will be within n time units? 439 | 440 | 24. Conditional Expectation 441 | 442 | This problem was asked by Robinhood. Stats hard 443 | Say X and Y are independent and uniformly distributed on (0, 1). What is the expected value of X, given that X > Y? 444 | 445 | 446 | 25. Geometric expectation 447 | This problem was asked by Facebook. Stats hard 448 | Derive the expectation for a geometric distributed random variable. 449 | 450 | 26. Roll correlation 451 | 452 | This problem was asked by Robinhood. Stats hard 453 | Say you roll a fair dice 5 times. Let X be the number of times a 2 was rolled, and Y the number of times a 3 was rolled. What is the correlation coefficient between X and Y? 454 | 455 | 27. Conditional roll 456 | This problem was asked by Tesla. Stats medium 457 | Say you roll a fair dice repeatedly. Let X be the number of rolls until a 1 is rolled, and Y the number of rolls until a 4 is rolled. What is E[X|Y=2]? 458 | 459 | 28. CDF distribution 460 | 461 | This problem was asked by Square. Stats hard 462 | Say we have a random variable X ~ D, where D is an arbitrary distribution. What is the distribution of F(X) where F is the CDF of X? 463 | 464 | 465 | 29. Customer credits 466 | 467 | This problem was asked by Slack. Stats medium 468 | Suppose that there is a new service with an API offering with credits where by each credit is capped to a certain amount of API usage. Each customer can use a credit and the lifetime of the credit can be modeled as exponentially distributed with an expectation of 2 days. A particular customer will need the API's capabilities for 60 days. How many credits should they purchase so that the probability of API shortage during the 60 days is no more than 1 percent? 469 | 470 | 471 | 30. Exponential conditional 472 | This problem was asked by Tesla. Stats hard 473 | Let X and Y be i.i.d exponentially distributed random variables. What is the expectation of X given that X > Y? 474 | 475 | 476 | 31. Uniform distribution 477 | This problem was asked by Apple. Stats medium 478 | Derive the mean and variance of the uniform distribution U(a, b). 479 | 480 | 32. Poisson MLE 481 | This problem was asked by Google. Stats hard 482 | Say you have N independent and identically distributed draws of a Poisson random variable. What is the best estimator for the parameter λ? What properties does this estimator have? 483 | 484 | 33. Uniform draws 485 | 486 | This problem was asked by Quora. Stats, medium 487 | 488 | Suppose you independently sample three values X ~ U(0, 1). What is the probability that the first value will be larger than the sum of the other two? 489 | 490 | 491 | 34. Joint density 492 | This problem was asked by Square. Stats hard 493 | Assume that you have two continuous random variables X and Y that have a joint density function of f(x, y) = x-y when 0 < y < x < 1 and 0 otherwise. What is the covariance of X and Y? 494 | 495 | 496 | 497 | 498 | 499 | 35. Normal mgf 500 | This problem was asked by Stripe. Stats hard 501 | Describe what a moment generating function (MGF) is. Derive the MGF for a normally distributed random variable X. 502 | 503 | 36. Lognormal mean. 504 | This problem was asked by Slack. Stats, hard 505 | Assume that log X ~ N(0, 1). What is the expectation of X? 506 | 507 | 37. Remaining politics 508 | This problem was asked by Twitter. Stats, easy 509 | Say you have two groups of random users for surveying, one side Democratic (with D total people) and the other side Republican (with R total people). At each time step, you remove a user randomly and survey them. You stop as soon as all of the Democratic side has been surveyed. At that point, how many Republican people do you expect to still be surveyed? 510 | 511 | 38. Summation Odds 512 | 513 | This problem was asked by Robinhood. Stats, hard 514 | Say you take N independent draws of a random variable X ~ Uniform(0, 1). What is the probability that the sum of those N draws is less than or equal to 1? Hint: try looking at N=2 and N=3. 515 | 516 | 517 | 39. Square root of uniform 518 | This problem was asked by Quora. Stats, medium. 519 | Let X be uniformly distributed between -1 and 1, i.e. X ~ U(-1, 1). Find the expectation of the square root of |X|. 520 | 521 | 522 | 40. Poisson sum 523 | This problem was asked by Twilio. Stats, hard 524 | Say you have two independent Possion random variables X and Y. What is the distribution of X+Y? 525 | 526 | 41. Central Limit Theorem 527 | This problem was asked by Uber. Stats, medium 528 | Explain the Central Limit Theorem and why it is useful. 529 | 530 | 42. Variance Bounds 531 | 532 | This problem was asked by Akuna Capital. Stats, medium 533 | Say you have two random variables X and Y, each with a standard deviation. What are the bounds on the variance of aX + bY for constants a and b? 534 | 535 | 43. Blended statistics 536 | This problem was asked by Google. Stats, hard 537 | Say you have two distinct subsets of a dataset for which you know their means and standard deviations. How do you calculate the blended mean and standard deviation of the total dataset? Can you extend it to K subsets? 538 | 539 | 44. Max of two rolls 540 | 541 | This problem was asked by Morgan Stanley. Stats, medium 542 | What is the expected value of the max of two dice rolls? 543 | 544 | 45. Confidence Intervals 545 | This problem was asked by Overstock. Stats, easy 546 | How would you explain a confidence interval to a non-technical audience? 547 | 46. Increasing rolls 548 | This problem was asked by Robinhood. Stats, hard 549 | Say you have an n-sided die. You keep rolling and sum the values as long as the current roll is larger than the previous. For example, if n = 6 then you might roll 1, 3, 2 and stop or 1, 4, 5, 3 and stop. In the first case, your total sum is 1 + 3 = 4, and in the second case your total sum if 1 + 4 + 5 = 10. What is the expected value of the sum? 550 | 551 | 47. Statistical power 552 | This problem was asked by Microsoft. Stats, easy 553 | Explain the statistical background behind power. 554 | 555 | 48. Random normal 556 | 557 | This problem was asked by Stripe. Stats, medium 558 | Say you have X ~ N(0, 1). Let Z = XY, where Y takes on two values, -1 and 1 equally with probability 0.5 each. What is the distribution of Z? 559 | 560 | 49. Monotonically increasing 561 | 562 | This problem was asked by Google. Stats, hard 563 | Assume you are drawing from an infinite set of iid random variables that are uniformly distributed from (0, 1). You keep drawing as long as the sequence you are getting is monotonically increasing. What is the expected length of the sequence you draw? 564 | 50. two fives 565 | 566 | This problem was asked by Akuna Capital. Stats, medium 567 | Say you’re rolling a fair six sided dice. What is the expected number of rolls until you roll two consecutive 5s? 568 | 51. hypothesis testing and p-value 569 | This problem was asked by Overstock. Stats, easy 570 | Describe hypothesis testing and p-values in layman's terms. 571 | 572 | 52. A/B testing 573 | This problem was asked by Overstock. Stats, easy, 574 | Describe some common pitfalls of A/B testing? 575 | 576 | 53. Type 1 and type 2 errors 577 | 578 | This problem was asked by Overstock, Stats, easy 579 | Describe what type I and type II errors are, and the tradeoffs between them. 580 | 581 | 54. Sampling from circle 582 | 583 | This problem was asked by Lyft. Stats hard, 584 | How do you uniformly sample points at random from a circle with radius R? 585 | 586 | 587 | ## Machine Learning 588 | 589 | 1. Fraud detection trade offs: 590 | This problem was asked by Affirm. Machine Learning. Medium 591 | Assume we have a classifier that produces a score between 0 and 1 for the probability of a particular loan application being fraudulent. In this scenario: a) what are false positives, b) what are false negatives, and c) what are the trade-offs between them in terms of dollars and how should the model be weighted accordingly? 592 | 593 | 2. Classification metrics 594 | This problem was asked by Uber. Machine Learning, medium 595 | Say you need to produce a binary classifier for fraud detection. What metrics would you look at, how is each defined, and what is the interpretation of each one? 596 | 597 | 3. Estimation of fraud 598 | This problem was asked by Affirm. Machine learning, Medium 599 | Assume we have some credit model, which has accurately calibrated (up to some error) score of how credit-worthy any individual person is. For example, if the model’s estimate is 92% then we can assume the actual score is between 91 and 93. If we take 92 as a score cutoff and deem everyone above that score as credit-worthy, are we overestimating or underestimating the actual population’s credit score? 600 | 601 | 4. Identifying synonyms 602 | This problem was asked by Google. ML . Medium, 603 | Say you are given a very large corpus of words. How would you identify synonyms? 604 | 605 | 5. L1 and L2 regularization 606 | This problem was asked by Uber. ML, Medium, 607 | What is L1 and L2 regularization? What are the differences between the two? 608 | 609 | 6. Square root of model squares 610 | This problem was asked by Affirm. ML, medium 611 | Assume we have a classifier that produces a score between 0 and 1 for the probability of a particular loan application behind a fraud. Say that for each application’s score, we take the square root of that score. How would the ROC curve change? If it doesn’t change, what kinds of functions would change the curve? 612 | 613 | 7. Bias -Variance Tradeoff 614 | 615 | This problem was asked by Microsoft., ML. Medium 616 | What is the bias-variance tradeoff? How is it expressed using an equation? 617 | 618 | 8. Modeling listing revenue 619 | This problem was asked by Airbnb. ML, medium 620 | Say you are modeling the yearly revenue of new listings. What kinds of features would you use? What data processing steps need to be taken, and what kind of model would run? 621 | 622 | 9. Recommending similar listings 623 | This problem was asked by Airbnb. ML, medium 624 | Say you are tasked with producing a model that can recommend similar listings to an Airbnb user when they are looking at any given listing. What kind of model would you use, what data is needed for that model, and how would you evaluate the model? 625 | 626 | 10. Adding noise 627 | This problem was asked by Google., ML, hard, 628 | Say we are running a probabilistic linear regression which does a good job modeling the underlying relationship between some y and x. Now assume all inputs have some noise ε added, which is independent of the training data. What is the new objective function? How do you compute it? 629 | 630 | 11. Item propensity modeling 631 | This problem was asked by Stitch Fix. ML, medium, 632 | How would you build a model to calculate a customer's propensity to buy a particular item? What are some pros and cons of your approach? 633 | 634 | 12. K-means clustering update 635 | This problem was asked by Netflix. ML, hard, 636 | What is the loss function used in k-means clustering for k clusters and n sample points? Compute the update formula using 1) batch gradient descent, 2) stochastic gradient descent for the cluster mean for cluster k using a learning rate ε. 637 | 638 | 13. Sensor sensitivity 639 | This problem was asked by Tesla. ML, hard 640 | You're working with several sensors that are designed to predict a particular energy consumption metric on a vehicle. Using the outputs of the sensors, you build a linear regression model to make the prediction. There are many sensors, and several of the sensors are prone to complete failure. What are some cost functions you might consider, and which would you decide to minimize in this scenario? 641 | 642 | 14. Expectation maximization 643 | This problem was asked by Netflix. ML, hard, 644 | What is Expectation-Maximization and when is it useful? Describe the setup algorithmically with formulas. 645 | 646 | 15. Fraud detection 647 | 648 | This problem was asked by Stripe. ML< hard 649 | Say we are using a Gaussian Mixture Model (GMM) for anomaly detection on fraudulent transactions to classify incoming transactions into K classes. Describe the model setup formulaically and how to evaluate the posterior probabilities and log likelihood. How can we determine if a new transaction should be deemed fraudulent? 650 | 651 | 16. Information gain and entropy 652 | 653 | This problem was asked by Microsoft. ML medium 654 | Explain what Information Gain and Entropy are in a Decision Tree. 655 | 656 | 17. Kernel regression estimator 657 | This problem was asked by Netflix. ML,hard 658 | Describe the idea and mathematical formulation of kernel smoothing. How do you compute the kernel regression estimator? 659 | 660 | 18. Guessing Gaussian 661 | 662 | This problem was asked by Stripe. ML hard, 663 | Say we have N observations for some variable which we model as being drawn from a Gaussian distribution. What are your best guesses for the parameters of the distribution? Derive it mathematically. 664 | 19. LS equivalent 665 | 666 | This problem was asked by Airbnb. ML hard 667 | Suppose you are running a linear regression and model the error terms as being normally distributed. Show that in this setup, maximizing the likelihood of the data is equivalent to minimizing the sum of squared residuals. 668 | 669 | 20. Logistic regression 670 | This problem was asked by Stripe. ML hard 671 | Describe the model formulation behind logistic regression. How do you maximize the log-likelihood of a given model (using the two-class case)? 672 | 673 | 21. Linear decision boundaries 674 | This problem was asked by Opendoor. ML hard 675 | Describe the setup and assumptions of using linear discriminant analysis (LDA). Show mathematically that the decision boundaries are linear. 676 | 677 | 22. LDA subspaces 678 | 679 | This problem was asked by Opendoor. ML, hard 680 | 681 | Suppose you are running a linear discriminant analysis (LDA) model on some data with K classes. Describe mathematically how you would project centroids to some L < K-1 dimensional subspace. 682 | 683 | 23. Bayesian linear regression 684 | This problem was asked by Airbnb. ML hard 685 | Suppose you use a Gaussian prior on β of a linear regression. Derive the MAP estimate of β. 686 | 687 | 24. Maximum entropy 688 | This problem was asked by Netflix. ML, hard 689 | Describe entropy in the context of machine learning, and show mathematically how to maximize it assuming N states. 690 | 691 | 25. Projection matrix 692 | This problem was asked by Airbnb. ML, hard 693 | In linear regression, what is the projection matrix? Derive the matrix formulation of it. 694 | 695 | 26. variance estimate for ls 696 | This problem was asked by Stripe. ML, hard 697 | Derive the variance-covariance matrix of the least squares parameter estimates in matrix form. 698 | 699 | 700 | 701 | 702 | 27. Deriving PCA 703 | This problem was asked by Netflix. ML, hard 704 | Describe the idea behind PCA and go through its formulation and derivation in matrix form. Go through the procedural description and solve the constrained maximization. 705 | 706 | 28. SVMs 707 | This problem was asked by Microsoft. ML, hard 708 | Formulate the background behind an SVM, and show the optimization problem it aims to solve. 709 | 710 | 29. Generative and discriminative 711 | 712 | This problem was asked by Amazon. ML, medium 713 | Describe both generative and discriminative models and give an example of each. 714 | 715 | 30. Gradient descent 716 | This problem was asked by Amazon. ML, medium 717 | Describe gradient descent and the motivations behind stochastic gradient descent. 718 | 719 | 31. Convex and Non-convex 720 | 721 | This problem was asked by Amazon. ML, medium 722 | Define what it means for a function to be convex. What is an example of a machine learning algorithm that is not convex and describe why that is so. 723 | 724 | 32. Random forest and boosting 725 | This problem was asked by Overstock. ML, medium 726 | Compare and contrast gradient boosting and random forests. 727 | 728 | 729 | 730 | 731 | 33. Improving logistic regression 732 | 733 | This problem was asked by Airbnb. ML, easy 734 | Say you are running a simple logistic regression on a problem but find the results to be unsatisfactory. What are some ways you might improve your model or what other models might you look into? 735 | 736 | 34. Cross validation 737 | This problem was asked by Overstock. ML, medium 738 | Define the cross validation process. What is the motivation behind using it? 739 | 740 | 35. GNB vs LR 741 | This problem was asked by Citadel. ML, medium 742 | Compare and contrast GNB and logistic regression. When would you use one over the other? 743 | 744 | 36. Boosting description 745 | 746 | This problem was asked by Overstock. ML, easy 747 | Describe the idea behind boosting. Give an example of one method and describe one advantage and disadvantage it has. 748 | 749 | 37. Precision and recall 750 | 751 | This problem was asked by Overstock ML easy 752 | Describe precision and recall and their formulas. Why are they important to look at and what is the trade-off between the two? 753 | 754 | 755 | ## Python/Coding 756 | Sum of the consecutive numbers 757 | This problem was asked by Robinhood. Python/Coding, Hard 758 | Given a number n, return the number of lists of consecutive positive integers that sum up to n. 759 | 760 | 2. 761 | This problem was asked by Lyft. Coding, Medium 762 | Say we are given a list of several categories (for example, the strings: A, B, C, and D) and want to sample from a list of such categories according to a particular weighting scheme. Such an example would be: for 100 items total, we want to see A 20% of the time, B 15% of the time, C 35% of the time, and D 30% of the time. How do we simulate this? What if we care about an arbitrary number of categories and about memory usage? 763 | 764 | 3. Generating integer partitions 765 | This problem was asked by Stripe. Coding, Medium, 766 | Write a program to generate the partitions for a number n. A partition for n is a list of positive integers that sum up to n. For example: if n = 4, we want to return the following partitions: [1,1,1,1], [1,1,2], [2,2], [1,3], and [4]. Note that a partition [1,3] is the same as [3,1] so only the former is included. 767 | 768 | 4. Correlation by hand 769 | This problem was asked by Robinhood. Coding, medium, 770 | Write a program to calculate correlation (without any libraries except for math) for two lists X and Y. 771 | 772 | 773 | 774 | 5. Max Sum increasing subsequence 775 | 776 | This problem was asked by Uber. Coding, medium, 777 | Given a list of positive integers, return the maximum increasing subsequence, that is, the largest increasing subsequence within the array that has the maximum sum. Examples: if the input is [5, 4, 3, 2, 1] then return 5 (since no subsequence is increasing), if the input is [3, 2, 5, 7, 6] return 15 = 3 + 5 + 7, etc. 778 | 779 | 6. perfect square count 780 | This problem was asked by Palantir. Coding, Medium, 781 | Given a positive integer n, find the smallest number of perfect squares that sum up to n. For example, for n = 7, you should return 4 since 7 = 4 + 1 + 1 +1, and for n = 13, you should return 2 since 13 = 4 + 9. 782 | 783 | 7. friendship distance 784 | This problem was asked by Facebook. Coding, Medium, 785 | You have the entire social graph of Facebook users, with nodes representing users and edges representing friendships between users. Given the edges of the graph and the number of nodes, write a function to return the smallest number of friendships in-between two users. 786 | For example, if the graph consists of 5 users A, B, C, D, E, and the friendship edges are: (A, B), (A, C), (B, D), (D, E) then the function should return 2 for the input A and E. 787 | 788 | 8. Estimating PI 789 | 790 | This problem was asked by Stripe. Coding medium 791 | Estimate π using a Monte Carlo method. Hint: think about throwing darts on a square and seeing where they land within a circle. 792 | 793 | 794 | 795 | 796 | 9. Median of data stream 797 | 798 | This problem was asked by Palantir. Coding, hard, 799 | Given a stream of elements (of arbitrary size), write a class to find the median at any given time. Your class should have a function to add numbers to the stream and a function to calculate the median. 800 | 801 | 10. Finding the peaks 802 | This problem was asked by Reddit. Coding, Medium 803 | Given an array A of positive integers, a peak element is defined as an element that is greater than its neighbors. 804 | For example, if A = [3, 5, 2, 4, 1] you should return either 1 or 3 since index 1 is 5, and index 3 is 4, and both are peak elements. Find the index of any peak elements. 805 | 806 | 11. Topic groups 807 | 808 | This problem was asked by Twitter. Coding, medium 809 | Say that there are n topics on Twitter and there is a notion of topics being related. Specifically, if topic A is related to topic B, and topic B is related to topic C, then topic A is indirectly related to topic C. 810 | Define a topic group to be any group of topics that either directly or indirectly related. Given an n by n adjacency matrix N, where N[i][j] = 1 if topic i and topic are j related and 0 otherwise, write a function to determine how many topic groups are there. 811 | 12. Permutations 812 | This problem was asked by Dropbox. Coding, medium 813 | Given n distinct integers, write a function to generate all permutations of those integers. 814 | 815 | 13. Intersection of two arrays. 816 | 817 | This problem was asked by Pinterest. Coding, easy 818 | Given two arrays, write a function to get the intersection of the two. 819 | For example, if A = [2, 4, 1, 5, 0], and B = [3, 4, 5] then you should return [4, 5]. 820 | 14. Palindromic subset 821 | This problem was asked by Airbnb. Coding, medium 822 | Given a number x, define a palindromic subset as any subsequence within x that is a palindrome. Write a function that returns the number of digits of the longest palindromic subset. 823 | For example, if x is 93567619 then you should return 5 since the longest subset would be 96769, which is a 5 digit number. 824 | 825 | 15. Splitting parenthesis 826 | This problem was asked by Twitter. Coding medium, 827 | Given a string with lowercase characters and left and right parentheses, remove the minimum number of parentheses so that the string is valid. 828 | For example, if the string is ")a(b((cd)e(f)g)" then return "ab((cd)e(f)g)". 829 | 830 | 16. First Missing Positive 831 | 832 | This problem was asked by Snapchat. Coding, hard, 833 | Given an arbitrary array of positive integers, find the smallest missing positive integer. Can you do it with O(1) space? 834 | For example, if A = [1, 3, 6, 2, 7] and then you should return 4. 835 | 836 | 17. Obstacle paths 837 | This problem was asked by Twitch. Coding medium 838 | You are given an m by n matrix with with 0s and 1s, where a 1 represents an obstacle and a 0 represents no obstacle. Determine the number of ways to navigate from the top-left corner of the matrix to the bottom right corner given that at any point in time there is only a move down or to the right as long as there is not an obstacle in that spot. 839 | For example, if the matrix is given by: [[0, 0, 0], [1, 1, 0], [0, 1, 0]] then you should return 1 since there is exactly one path. 840 | 841 | 842 | 18. Max of sliding window 843 | This problem was asked by Lyft. Coding hard 844 | Given an array A of positive integers and an integer k, write a function to get the largest value within the sliding window of size k for A. Each sliding window is k numbers and moves from the leftmost to the rightmost within A, one position at a time. 845 | For example, if A = [2, 5, 3, 1, 4] and n = 2, then you should return [5, 5, 3, 4]. 846 | 847 | 19. Smallest K pairs 848 | 849 | This problem was asked by Apple. Coding medium 850 | Given two sorted arrays of positive integers, and an integer k, determine the k smallest pairs among the two arrays, where a pair is defined as having exactly one element from the first array and one element from the second array. 851 | For example, if the k = 3 and the two arrays are [1, 3, 6, 10] and [2, 5, 7, 9] then [[1, 2], [3, 2], [1, 5]] since those are the three smallest pairs. 852 | 853 | 854 | 20. palindrome counting 855 | This problem was asked by Opendoor. Coding medium 856 | Given a string, return the count of substrings within the string that are palindromes. 857 | For example, if input is "aba": return 4, since the palindromes are: "a", "b", "a", and "aba". 858 | 859 | 21. All combinations 860 | This problem was asked by Twitch. Coding medium 861 | Given an integer n and an integer k, output a list of all of the combinations of k numbers from 1 to n. 862 | For example, if the n = 3, and k = 2 then return: [1, 2], [1, 3], [2, 3]. 863 | 864 | 865 | 866 | 867 | 22. Anagram grouping 868 | 869 | This problem was asked by Slack. Coding medium 870 | Given an array of strings, return a list of lists whereby each list has the strings that are an anagram of one another. 871 | For example, if input is ["abc", "abd", "cab", "bad", "bca", "acd"] then return: [["abc", "cab", "bca"], ["abd", "bad"], ["acd"]]. 872 | 873 | 23. Matrix Paths 874 | 875 | This problem was asked by Twitch. Coding hard 876 | Given an m by n matrix with positive integers, determine the length of the longest path of increasing integers within the matrix. 877 | For example, if the matrix is given by: [[1, 2, 3], [4, 5, 6], [7, 8, 9]] then you should return 5. 878 | 879 | 24. Repeating subarrays 880 | This problem was asked by Dropbox. Coding medium, 881 | Given two arrays with integers, return the maximum length of a common subarray within both arrays. 882 | For example, if the two arrays are [1, 3, 5, 6, 7] and [2, 4, 3, 5, 6] then return 3 since the maximum length is [3, 5, 6]. 883 | 884 | 25. Palindrome subsequence 885 | This problem was asked by Slack. Coding medium 886 | Given a string, find the length of its longest palindrome subsequence. 887 | For example, if the string is "acabcbabb" then return 5 since the longest palindrome subsequence is "abcba". 888 | 889 | 890 | 26. Tree diameter 891 | This problem was asked by Pinterest. Coding medium 892 | Given a binary tree, write a function to determine the diameter of the tree, which is the longest path between any two nodes. 893 | 894 | 27. choosing signs 895 | 896 | This problem was asked by Uber. Coding, medium 897 | You are given an array of integers and a target number. For each number, you can place either a + sign or a - sign in front of it. Write a function to calculate how many ways are there to do so such that the sum of the resulting expression is the target number. 898 | For example, if the array is: [1, 2, 3, 4] and the target is 4 then return 2 since the valid expressions are: -1-2+3+4 and +1+2-3+4. 899 | 900 | 28. Equal elements 901 | 902 | This problem was asked by Dropbox. Coding medium 903 | Find the minimum number of increments or decrements (by 1) needed to make all elements of an array be equal. 904 | For example, if the array is: [1, 2, 3, 4, 5] then return 1+2+0+2+1 = 6 since that is the smallest number of increments or decrements to make all elements of the array the same (3). 905 | 906 | 29. Total Anagrams 907 | This problem was asked by LinkedIn. Coding, medium 908 | You are given two strings A and B. Write a function to return a list of all the start indices within A for substrings of A that are anagrams of B. 909 | For example, if A = "abcdcbac" and B = "abc" then you want to return [0, 4, 5] since those are the starting indices of A whereby there are anagrams of B. 910 | 911 | 912 | 913 | 30. Internal removal 914 | This problem was asked by Pinterest. Coding, hard 915 | You are given an array of intervals, where each interval is represented by a start time and an end time, such as [1, 3]. Determine the smallest number of intervals to remove within the list such that the rest of the intervals are not overlapping (the times can "touch" such as [1, 3] and [3, 5] but overlap such as [1, 3] and [2, 5]). 916 | For example, if the interval list given is: [[1, 3], [3, 5], [2, 4], [6, 8]] then return 1 since the desired removal is the [2, 4] interval. 917 | 918 | 31. Closest points 919 | 920 | This problem was asked by Dropbox. Coding , easy 921 | Given a list of points, write a function to find the k closest points to the origin. 922 | For example, if the k = 3 and the points are: [[2, -1], [3, 2], [4, 1], [-1, -1], [-2,2]] then return [[-1, -1], [2, -1], [-2, 2]] since those are the three closest points. 923 | 924 | 32. List removal 925 | This problem was asked by Square. Coding, medium 926 | Write a function to remove the kth node from a linked list and return the head of the linked list. 927 | For example, if you have the linked list 3 → 2 → 5 → 1 → 4 and k = 3 then remove the 5 and return the linked list 3 → 2 → 1 → 4. 928 | 929 | 33. Subarray sum 930 | 931 | This problem was asked by Apple. Coding, medium 932 | You are given an array and an integer k. Determine the number of continuous subarrays that have a sum equal to k. 933 | For example, if the array list is given by [1, 2, 3, 2, 1] and k = 6, then return 2 since the two subarrays are: [1, 2, 3] and [3, 2, 1]. 934 | 935 | 936 | 34. Minimal Sum 937 | This problem was asked by Square., Coding , medium 938 | You are given an m-by-n matrix with positive integers. Say you start at the top-left corner at each time step can move either right or down. Determine the minimal sum of elements along this traversal in reaching the bottom right corner. 939 | 940 | 35. Matching wildcards 941 | 942 | This problem was asked by Slack. Coding, hard 943 | You are given an input string composed of the lowercase letters a-z and a particular regular expression that contains lowercase a-z, ?, or * whereby the ? matches any one character, and the * matches an arbitrary number of characters (empty as well). Write a function to return whether the regex matches the input string. 944 | 945 | 36. String subsequence 946 | This problem was asked by Twitter. Coding ,easy 947 | Given two strings, determine if the first string is a subsequence of the second string. Note that relative positioning matters. 948 | For example, if the inputs are "abcd" and "xyazbcd" then return true, but if the inputs are "abcd" and "xyazbdc" then return false. 949 | 950 | 37. Inorder traversal 951 | This problem was asked by Citadel. Coding, easy 952 | Given a binary tree, conduct an inorder traversal and return the values in an array. 953 | 954 | 38. Longest parenthesis 955 | This problem was asked by Citadel. Coding, hard 956 | Given a string with left and right parentheses, write a function to determine the length of the longest well-formed substring. 957 | For example, if the input string is ")(())(" then return 4 since the longest substring is 958 | 959 | 39. max of three 960 | 961 | This problem was asked by D.E Shaw. Coding, easy 962 | Given an integer array, return the maximum product of any three numbers in the array. 963 | For example, if the input is [-5, 2, 6, -4, 8, 2] then return 160. 964 | 965 | 40. Product without self 966 | 967 | This problem was asked by Dropbox. Coding, easy 968 | Say you have an array of n integers. Write a function to output a new array of values such that each value is the total product of the original array except for the current element. Can you do it in O(n) time without using division? 969 | For example, if the input is [1, 2, 3] then return [6, 3, 2]. 970 | 971 | 41. Max subarray 972 | 973 | This problem was asked by Akuna Capital. Coding, easy 974 | Given an integer array, find the sum of the largest contiguous subarray within the array. 975 | For example, if the input is [-1, -3, 5, -4, 3, -6, 9, 2] then return 11. 976 | 977 | 42. Sorted matrix kth smallest 978 | 979 | This problem was asked by Reddit. Coding, easy 980 | Say you have an n by n matrix of elements which is sorted in ascending order both in the columns and rows. Return the kth smallest element of the matrix. 981 | For example, if the input is [[1, 4, 7], [3, 5, 9], [6, 8, 11]] and k = 4 then return 5. 982 | 983 | 984 | 985 | 986 | 987 | 988 | 989 | 990 | 991 | 992 | 43. Splitting array 993 | 994 | This problem was asked by Snapchat. Coding, hard 995 | Given an array A of positive integers and an integer n, write a function to minimize the largest sum among any arbitrary split of A into n non-empty contiguous subarrays. 996 | For example, if A = [9, 3, 6, 8, 4] and n = 2, then you should return 18 since the best possible split is: [9, 3, 6] and [8, 4] which results in the largest sum of 18. 997 | 998 | 44. Dice Roll Target 999 | 1000 | This problem was asked by Uber. Coding, medium 1001 | Suppose you have n dice, and each has k faces from 1..k. Write a function to determine the number of ways of rolling the die such that the sum is a particular given target value. 1002 | For example, if n = 2, k = 6, and the target is 7, then you should return 6 since there are 6 possible ways to get a total sum of 7. 1003 | 1004 | 45. Minimum depths 1005 | 1006 | This problem was asked by Uber. Coding, easy 1007 | Given a binary tree, write a function to determine the minimum depth of the tree (the number of nodes on the shortest path from the root down to a leaf node). 1008 | 1009 | 1010 | 1011 | ## Open ended Product Questions 1012 | 1.Social graph comparison 1013 | 1014 | This problem was asked by Facebook. Easy, Product 1015 | 1016 | Imagine the social graphs for both Facebook and Twitter. How do they differ? What metric would you use to measure how skewed the social graphs are? 1017 | 1018 | 2. Surge pricing 1019 | This problem was asked by Uber. easy, product 1020 | 1021 | You’re on the data science team and are responsible for figuring out surge pricing. Why does it need to exist and what metrics and data should you track? 1022 | 1023 | 3. Difficulties in A/B testing 1024 | 1025 | This problem was asked by Airbnb., Easy, Product 1026 | What are some factors that might make testing metrics on the Airbnb platform difficult? 1027 | 1028 | 4. Rider app change 1029 | This problem was asked by Lyft. Product, easy 1030 | Your team is trying to figure out whether a new driver app with extra UI features will increase the number of rides taken. How would you test whether the extra features in the app make it better than the original version? 1031 | 1032 | 5. News feed metrics 1033 | 1034 | This problem was asked by Facebook. Product, easy, 1035 | Let’s say that you are the first person working on the Facebook News Feed. What metrics would you track and how would you improve those metrics? 1036 | 1037 | 1038 | 1039 | 1040 | 6. Improving product engagement 1041 | 1042 | This problem was asked by Twitter. Product, easy 1043 | How would you improve product engagement on Twitter? 1044 | 1045 | 7. Two factor authentication 1046 | This problem was asked by Robinhood. Product, easy 1047 | Say you are deciding whether to implement two-step authentication when users log in. What data would you look at and how can you make your decision? 1048 | 1049 | 8. Measuring the comments 1050 | 1051 | This problem was asked by Facebook. Product, easy, 1052 | Let's say Facebook has expanded into a previously untapped geographical region. Looking at weekly metrics, you see a slow decrease in the average number of comments per user over several months. You also know that new users have been growing at a steady linear rate in the area for the same time frame. What are some reasons why the average number of comments per user would be decreasing and what metrics would you look into? 1053 | 9. Posting drop. 1054 | This problem was asked by Facebook. Product, medium 1055 | Let’s say that the usage of a Facebook posting tool dropped from 2% posts per user last month to 1% post per user today. What might be some potential causes and how would you go about understanding this drop? 1056 | 10. Disney+ retention 1057 | 1058 | This problem was asked by Disney. Product, easy 1059 | Disney+ offers a 7-day free trial period. After 7 days, customers are charged whatever package they chose. Assume that there are customers who commit to Disney+ right away and therefore don't end up having a 7-day free trial period. 1060 | Disney wants to measure the success of the free trial. What metrics and analysis might you do to determine whether or not the free trial successfully acquires new customers? 1061 | 1062 | 11. shipping times 1063 | This problem was asked by Wayfair. Product , easy 1064 | If you are selling a product and want to decrease the shipment time from 2 days to 1 day to increase your amount of customers, what are 2 ways to quantify it and 2 risks of this idea? 1065 | 1066 | 12. Linkedin Status 1067 | 1068 | This problem was asked by LinkedIn. Product, easy 1069 | LinkedIn recently launched a "status" feature where you can now see if a LinkedIn connection is online, symbolized by a green dot, idle, symbolized by an orange dot, or offline (gray dot) status that says how long ago the user was active. Assume that this feature has been around for a few months. What metrics would you look at to assess the success of this feature? 1070 | 1071 | 13. Acquiring new customers 1072 | This question was asked by Dropbox. Product easy 1073 | You are a data scientist who works directly with the CEO. Your boss says she is incredibly ecstatic because the average cost of acquiring a customer is a lot lower than the expected value of a customer. She thinks that the acquisition cost has been minimized and the value of a customer has almost been maximized. Help her interpret the metric and give a suggestion about how she should use it to try and maximize revenue. 1074 | 1075 | 14. Slack Engagement 1076 | 1077 | This problem was asked by Slack. Product, easy 1078 | What are some metrics you would use to measure user engagement at Slack? How would you be able to tell early whether or not user engagement is declining? 1079 | 1080 | 1081 | 1082 | 1083 | 1084 | 1085 | 15. Uber eats 1086 | This problem was asked by Uber. Product easy 1087 | Say you are on the UberEats team and considering shipping out a potential feature X. What metrics would you look at in order to A/B test this change? 1088 | 1089 | 16. Uber Pro 1090 | 1091 | This problem was asked by Uber. Product easy 1092 | Uber Pro is a program that is designed to reward outstanding drivers. Think of it like a reward program on the driver side. What do you think are the important metrics for Uber Pro to look at, and how might Uber be able to tell if the service is effective? 1093 | 1094 | 17. Duolingo success 1095 | This problem was asked by Duolingo. Product easy 1096 | How would you measure Duolingo's success from a product standpoint, and another metric you would use to measure its success from a financial standpoint? 1097 | 1098 | 1099 | 18. Google doodle 1100 | This problem was asked by Google. Product easy 1101 | Let's say you are on the team for Google Doodles. What metrics would you use to measure how successful a given Doodle was? 1102 | 1103 | 19. New feature on duolingo 1104 | 1105 | This problem was asked by Duolingo. Product easy 1106 | Duolingo wants a feature that will increase the user engagement and overall network effect. What features would you recommend and what data would you test and or look at to support your hypotheses? 1107 | 1108 | 1109 | 1110 | 20. Fake news 1111 | 1112 | This problem was asked by Facebook. Product easy 1113 | How would you identify the volume of news feed posts on Facebook that should be deemed as "fake" via a machine learning model? What features and input data would be relevant? 1114 | 1115 | 21. Credit card stickiness 1116 | This problem was asked by Capital One. Product, easy 1117 | How would you assess the stickiness of the Capital One Quicksilver card? 1118 | 1119 | 22. growth or retention 1120 | This problem was asked by Netflix. Product, easy 1121 | Your manager has two potential features for Netflix to pursue. One is focused on increasing user growth while the other is focused on increasing user retention. Which product would you prioritize and what metric you would use to evaluate whether or not the product is successful? 1122 | 1123 | 23. Newest user batch 1124 | 1125 | This problem was asked by Facebook. Product, easy 1126 | You work at Facebook and see that there is an increase in the number of accounts created per month, but you want to see whether or not the amount of sticky/engaged users is growing or not from these sign-ups. How might you define and monitor the new batch of users? 1127 | 1128 | 24. Evaluating product engagement 1129 | 1130 | This problem was asked by LinkedIn. Product, easy 1131 | Say you are working at LinkedIn and your manager is worried that LinkedIn is a product that many people have due to the large professional network it has, but is not particularly engaging. What metrics would you look at to assess this? 1132 | 1133 | 1134 | 25. Decrease in active users 1135 | 1136 | This problem was asked by Snapchat. Product, easy 1137 | Let's say Snapchat saw an overall 10% decrease in daily active users, a trend that stayed consistent over the last two weeks. How would you try to look at the root cause of this? 1138 | 1139 | 26. News feed ranking 1140 | This problem was asked by Facebook. Product, easy 1141 | Suppose you are to build out Facebook's news feed ranking system. What types of signals would you look into and why? 1142 | 1143 | 27. Market expansion 1144 | This problem was asked by Walmart. Product easy 1145 | You work at Walmart, and need to figure out the next city for international expansion. How would you pick the city? What metrics would you look at to help inform this decision? 1146 | 1147 | 28. Driver time 1148 | This problem was asked by Lyft. Product, easy 1149 | The average wait time of a driver has increased. What factors do you think influenced this and why? 1150 | 1151 | 29. Mobile discrepancy 1152 | This problem was asked by Facebook. Product, easy 1153 | If 70% of Facebook users on iOS use Instagram, but only 35% of Facebook users on Android use Instagram, how would you investigate the discrepancy? 1154 | 1155 | 1156 | 1157 | 30. new pricing 1158 | This problem was asked by Netflix. Product, easy 1159 | Let's say Netflix is planning to launch its service in a few new countries internationally. How would you think about pricing for each country? 1160 | 1161 | 31. Handling outliers 1162 | This problem was asked by Spotify. Product, medium 1163 | How do you deal with outliers? What are some causes for them? 1164 | 1165 | 32. Market sizing 1166 | This problem was asked by Uber. Product, easy 1167 | How would you estimate the market size for Uber in the US in large cities? How might your assumptions be wrong? 1168 | 1169 | 33. Customer segmentation 1170 | This problem was asked by Apple. Product easy, 1171 | Say you have data on millions of users with many transactions across a variety of products. What types of insights would you look into and why? 1172 | 1173 | -------------------------------------------------------------------------------- /Simulating the fair coin with a biased one with March 7 2021.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "ExecuteTime": { 7 | "end_time": "2021-03-03T15:06:18.500645Z", 8 | "start_time": "2021-03-03T15:06:18.455823Z" 9 | } 10 | }, 11 | "source": [ 12 | "sergazy.nurbavliyev@gmail.com © 2021" 13 | ] 14 | }, 15 | { 16 | "cell_type": "markdown", 17 | "metadata": {}, 18 | "source": [ 19 | "## Simulating a Fair Coin with a Biased Coin" 20 | ] 21 | }, 22 | { 23 | "cell_type": "markdown", 24 | "metadata": {}, 25 | "source": [ 26 | "Question: Assume we have a biased coin ($p\\neq1/2$). Can you simulate a fair coin using our a biased coin?" 27 | ] 28 | }, 29 | { 30 | "cell_type": "markdown", 31 | "metadata": {}, 32 | "source": [ 33 | "## Answer" 34 | ] 35 | }, 36 | { 37 | "cell_type": "markdown", 38 | "metadata": {}, 39 | "source": [ 40 | "Let us first understand what the question is asking. We would like to get a fair using this biased coin even though we don't know how biased our coin is. Assume that head comes up with probability $p$, and tail comes up with probability $q$. Note $p+q=1$ In other words \n", 41 | "\\begin{equation*}\n", 42 | "\\mathbb{P}(H) = p \\text{ and } \n", 43 | "\\mathbb{P}(T) = 1-p=q\n", 44 | "\\end{equation*}\n", 45 | "We will use the great mathematician John von Neumann's solution. He suggests throw a biased coin twice and then calls heads and tails if the results of the biased coin are different. If the results of biased coin are the same then ignore the results and restart over. To see clearly, write \n", 46 | "\n", 47 | "$\\mathbb{P}(HH) = \\mathbb{P}(H) * \\mathbb{P}(H) = p * p $
\n", 48 | "$\\mathbb{P}(HT) = \\mathbb{P}(H) * \\mathbb{P}(T) = p * q $
\n", 49 | "$\\mathbb{P}(TH) = \\mathbb{P}(T) * \\mathbb{P}(H) = q * p $
\n", 50 | "$\\mathbb{P}(TT) = \\mathbb{P}(T) * \\mathbb{P}(T) = q * q $\n", 51 | "\n", 52 | "Since $p\\neq1/2$, we know $p^2\\neq q^2$. Thus we use $HT$ or $TH$ because $\\mathbb{P}(HT)=\\mathbb{P}(TH)$. \n", 53 | " \n", 54 | "Thus following Neumann's brilliant approach we call heads if we get $HT$ after flipping biased coin twice and call tails if we get $TH$. In other cases, we throw the results and start over again. " 55 | ] 56 | }, 57 | { 58 | "cell_type": "code", 59 | "execution_count": null, 60 | "metadata": {}, 61 | "outputs": [], 62 | "source": [] 63 | }, 64 | { 65 | "cell_type": "code", 66 | "execution_count": null, 67 | "metadata": {}, 68 | "outputs": [], 69 | "source": [] 70 | }, 71 | { 72 | "cell_type": "markdown", 73 | "metadata": {}, 74 | "source": [ 75 | "## Python code for simulation" 76 | ] 77 | }, 78 | { 79 | "cell_type": "code", 80 | "execution_count": 56, 81 | "metadata": { 82 | "ExecuteTime": { 83 | "end_time": "2021-03-08T05:28:05.288271Z", 84 | "start_time": "2021-03-08T05:28:05.267999Z" 85 | } 86 | }, 87 | "outputs": [ 88 | { 89 | "name": "stdout", 90 | "output_type": "stream", 91 | "text": [ 92 | "0.45819079723218104 we chose random p between 0 and 1\n" 93 | ] 94 | } 95 | ], 96 | "source": [ 97 | "import random\n", 98 | "p=random.uniform(0,1)\n", 99 | "print(p,'we chose random p between 0 and 1')\n", 100 | "def biased(p):\n", 101 | " return int(random.random() < p)\n", 102 | "def fair():\n", 103 | " coin_1, coin_2 = 0,0\n", 104 | " while coin_1 == coin_2:\n", 105 | " coin_1, coin_2 = biased(p), biased(p)\n", 106 | " return coin_1" 107 | ] 108 | }, 109 | { 110 | "cell_type": "code", 111 | "execution_count": 57, 112 | "metadata": { 113 | "ExecuteTime": { 114 | "end_time": "2021-03-08T05:28:05.580518Z", 115 | "start_time": "2021-03-08T05:28:05.511614Z" 116 | } 117 | }, 118 | "outputs": [ 119 | { 120 | "data": { 121 | "text/plain": [ 122 | "45813" 123 | ] 124 | }, 125 | "execution_count": 57, 126 | "metadata": {}, 127 | "output_type": "execute_result" 128 | } 129 | ], 130 | "source": [ 131 | "sum(biased(p) for i in range(10000))" 132 | ] 133 | }, 134 | { 135 | "cell_type": "code", 136 | "execution_count": 62, 137 | "metadata": { 138 | "ExecuteTime": { 139 | "end_time": "2021-03-08T05:36:02.472656Z", 140 | "start_time": "2021-03-08T05:34:05.097754Z" 141 | } 142 | }, 143 | "outputs": [], 144 | "source": [ 145 | "import numpy as np\n", 146 | "values = np.array([sum(fair() for i in range(j)) for j in range(10000)])" 147 | ] 148 | }, 149 | { 150 | "cell_type": "code", 151 | "execution_count": 67, 152 | "metadata": { 153 | "ExecuteTime": { 154 | "end_time": "2021-03-08T05:38:59.528967Z", 155 | "start_time": "2021-03-08T05:38:59.512283Z" 156 | } 157 | }, 158 | "outputs": [ 159 | { 160 | "name": "stderr", 161 | "output_type": "stream", 162 | "text": [ 163 | "/Users/sergazy/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:1: RuntimeWarning:\n", 164 | "\n", 165 | "invalid value encountered in long_scalars\n", 166 | "\n" 167 | ] 168 | } 169 | ], 170 | "source": [ 171 | "values2 =np.array([j/i for i,j in zip(range(10000),values)])" 172 | ] 173 | }, 174 | { 175 | "cell_type": "code", 176 | "execution_count": 70, 177 | "metadata": { 178 | "ExecuteTime": { 179 | "end_time": "2021-03-08T05:44:24.019275Z", 180 | "start_time": "2021-03-08T05:44:23.796804Z" 181 | } 182 | }, 183 | "outputs": [ 184 | { 185 | "data": { 186 | "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAD4CAYAAAD8Zh1EAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAefUlEQVR4nO3deXxU1f3/8dcnG4QdQtjCElYhLoBEFKwL4sLSSl0LrRvfr+XHV+1X6/dbRW1t7WK1rV2sFkot+rXVolYfShVFrTuoEAXZwQgIYQ2EPZD1/P6YSZgkN5khTEzuzfv5eOThzL1n7pwTzHvunHvOueacQ0RE/C+hsSsgIiLxoUAXEQkIBbqISEAo0EVEAkKBLiISEEmN9cadO3d2mZmZjfX2IiK+9Mknn+x2zqV77Wu0QM/MzCQnJ6ex3l5ExJfM7Mva9qnLRUQkIBToIiIBoUAXEQkIBbqISEAo0EVEAiJqoJvZHDPbZWYra9lvZvawmeWa2XIzOz3+1RQRkWhiOUN/AhhXx/7xwMDwzzRg5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LOXUOw27wD2GJmJ4U3jQVWE+A2E+pqOcvMWoXrOhZYQ7DbXCGebYw81pWE/l7q/obS2BcV6nERYgKhESFfAPc0dn1OoB1fI/T1aTmwLPwzgVAf2b+Bz8P/7RTxmnvC7V5HxNV+IBtYGd73CFEunDSFH+B8jl0UDXSbgWFATvjf+kWgYzNo833A2nB9/0ZodEeg2gz8g9A1ghJCZ9P/Gc82Ai2B54BcQiNh+kWrk6b+i4gEhN+6XEREpBYKdBGRgFCgi4gEhAJdRCQgFOgiIgGhQBcRCQgFuohIQPx/zhSN9ogdlC4AAAAASUVORK5CYII=\n", 187 | "text/plain": [ 188 | "
" 189 | ] 190 | }, 191 | "metadata": { 192 | "needs_background": "light" 193 | }, 194 | "output_type": "display_data" 195 | } 196 | ], 197 | "source": [ 198 | "import matplotlib.pyplot as plt\n", 199 | "plt.plot(values2)\n", 200 | "plt.show()" 201 | ] 202 | }, 203 | { 204 | "cell_type": "code", 205 | "execution_count": null, 206 | "metadata": {}, 207 | "outputs": [], 208 | "source": [] 209 | } 210 | ], 211 | "metadata": { 212 | "author": "g", 213 | "hide_input": false, 214 | "kernelspec": { 215 | "display_name": "Python 3", 216 | "language": "python", 217 | "name": "python3" 218 | }, 219 | "language_info": { 220 | "codemirror_mode": { 221 | "name": "ipython", 222 | "version": 3 223 | }, 224 | "file_extension": ".py", 225 | "mimetype": "text/x-python", 226 | "name": "python", 227 | "nbconvert_exporter": "python", 228 | "pygments_lexer": "ipython3", 229 | "version": "3.7.5" 230 | }, 231 | "latex_envs": { 232 | "LaTeX_envs_menu_present": true, 233 | "autoclose": false, 234 | "autocomplete": true, 235 | "bibliofile": "biblio.bib", 236 | "cite_by": "apalike", 237 | "current_citInitial": 1, 238 | "eqLabelWithNumbers": true, 239 | "eqNumInitial": 1, 240 | "hotkeys": { 241 | "equation": "Ctrl-E", 242 | "itemize": "Ctrl-I" 243 | }, 244 | "labels_anchors": false, 245 | "latex_user_defs": false, 246 | "report_style_numbering": false, 247 | "user_envs_cfg": false 248 | } 249 | }, 250 | "nbformat": 4, 251 | "nbformat_minor": 4 252 | } 253 | -------------------------------------------------------------------------------- /Unfair Coin March 4 2021.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "ExecuteTime": { 7 | "end_time": "2021-03-03T15:06:18.500645Z", 8 | "start_time": "2021-03-03T15:06:18.455823Z" 9 | } 10 | }, 11 | "source": [ 12 | "sergazy.nurbavliyev@gmail.com © 2021" 13 | ] 14 | }, 15 | { 16 | "cell_type": "markdown", 17 | "metadata": {}, 18 | "source": [ 19 | "## Detecting Unfair Coin" 20 | ] 21 | }, 22 | { 23 | "cell_type": "markdown", 24 | "metadata": {}, 25 | "source": [ 26 | "Question: Assume we have a fair coin (one side heads and the other side tails) also we have an unfair coin (both sides heads). You pick randomly one coin, and flip it 5 times. You get 5 heads in a row. What is the probability that you are indeed flipping the unfair coin?\n" 27 | ] 28 | }, 29 | { 30 | "cell_type": "markdown", 31 | "metadata": {}, 32 | "source": [ 33 | "### Intuition" 34 | ] 35 | }, 36 | { 37 | "cell_type": "markdown", 38 | "metadata": {}, 39 | "source": [ 40 | "Assume you flip a fair coin 5 times, what is the probability of getting 5 heads in a row. That is $\\frac{1}{2^5}$. \n", 41 | "If this is confusing, think this way, take 5 fair coin and flip once, and now the same question what is the probability of getting 5 heads? The same answer that is $\\frac{1}{2^5}$. Which is around 0.03125. If you dont have a calculator, then rougly you can guess $3/96\\approx 3/100=0.03$. That tells us probability of flipping an unfair coin is around 0.97. \n", 42 | "\n", 43 | "If you are flipping an unfair coin well then probability of getting 5 head is 1. Now correct answer should be close to these numbers." 44 | ] 45 | }, 46 | { 47 | "cell_type": "code", 48 | "execution_count": 1, 49 | "metadata": { 50 | "ExecuteTime": { 51 | "end_time": "2021-03-04T16:06:19.118849Z", 52 | "start_time": "2021-03-04T16:06:19.007415Z" 53 | } 54 | }, 55 | "outputs": [ 56 | { 57 | "data": { 58 | "text/plain": [ 59 | "0.03125" 60 | ] 61 | }, 62 | "execution_count": 1, 63 | "metadata": {}, 64 | "output_type": "execute_result" 65 | } 66 | ], 67 | "source": [ 68 | "1/32" 69 | ] 70 | }, 71 | { 72 | "cell_type": "code", 73 | "execution_count": null, 74 | "metadata": {}, 75 | "outputs": [], 76 | "source": [] 77 | }, 78 | { 79 | "cell_type": "markdown", 80 | "metadata": {}, 81 | "source": [ 82 | "### Theoritical result" 83 | ] 84 | }, 85 | { 86 | "cell_type": "markdown", 87 | "metadata": {}, 88 | "source": [ 89 | "As you can guess we will use Bayes theorem here. \n", 90 | "We will denote with $U$ letter if we are flipping the unfair coin and $F$ letter if we are flipping a fair\n", 91 | "Since we are picking randomly one coin, $\\mathbb{P}(U)=\\mathbb{P}(F)=1/2$.\n", 92 | "\n", 93 | "Let 5H represent the case where we get 5 heads in a row. Then we want to find the probability that we are flipping the unfair coin, given that we saw 5 heads in a row.\n", 94 | "i.e. $\\mathbb{P}(U|5H)$. \n", 95 | "If we are given an unfair coin and then the probability of getting 5 heads in a row would be 1. i.e. $\\mathbb{P}(5H|U)=1$. With the same logic if we have fair coin and then the probability of getting 5 heads in a row would be 1/32. i.e. $\\mathbb{P}(5H|F)=\\frac{1}{2^5}.$ We actually collected all the information we want. Now using Bayes rule we get\n", 96 | "\\begin{equation}\n", 97 | "\\mathbb{P}(U|5H)=\\dfrac{\\mathbb{P}(5H|U)\\mathbb{P}(U)}{\\mathbb{P}(5H|U)\\mathbb{P}(U)+\\mathbb{P}(5H|F)\\mathbb{P}(F)}=\\frac{\\frac{1}{2}*1}{\\frac{1}{2}*1+\\frac{1}{2}*\\frac{1}{2^5}}=\\frac{32}{33}= 0.9696969696969697\n", 98 | "\\end{equation}" 99 | ] 100 | }, 101 | { 102 | "cell_type": "code", 103 | "execution_count": 2, 104 | "metadata": { 105 | "ExecuteTime": { 106 | "end_time": "2021-03-04T16:06:19.141301Z", 107 | "start_time": "2021-03-04T16:06:19.130704Z" 108 | } 109 | }, 110 | "outputs": [ 111 | { 112 | "data": { 113 | "text/plain": [ 114 | "0.9696969696969697" 115 | ] 116 | }, 117 | "execution_count": 2, 118 | "metadata": {}, 119 | "output_type": "execute_result" 120 | } 121 | ], 122 | "source": [ 123 | "32/33" 124 | ] 125 | }, 126 | { 127 | "cell_type": "markdown", 128 | "metadata": {}, 129 | "source": [ 130 | "## Python code for our intuition" 131 | ] 132 | }, 133 | { 134 | "cell_type": "code", 135 | "execution_count": 3, 136 | "metadata": { 137 | "ExecuteTime": { 138 | "end_time": "2021-03-04T16:06:19.165738Z", 139 | "start_time": "2021-03-04T16:06:19.154640Z" 140 | } 141 | }, 142 | "outputs": [], 143 | "source": [ 144 | "import scipy.stats as stats\n", 145 | "def fair(n_trials):\n", 146 | " return stats.bernoulli.rvs(0.5, size=n_trials) # this returns an array of 0s and 1s\n", 147 | "def unfair(n_trials):\n", 148 | " return stats.bernoulli.rvs(1, size=n_trials) ## this returns an array of 1s" 149 | ] 150 | }, 151 | { 152 | "cell_type": "code", 153 | "execution_count": 17, 154 | "metadata": { 155 | "ExecuteTime": { 156 | "end_time": "2021-03-04T16:22:01.826906Z", 157 | "start_time": "2021-03-04T16:22:01.791422Z" 158 | } 159 | }, 160 | "outputs": [], 161 | "source": [ 162 | "import numpy as np\n", 163 | "count_f=0\n", 164 | "count_unf=0\n", 165 | "for j in range(100):\n", 166 | " data = fair(5)\n", 167 | " if np.sum(data)==5:\n", 168 | " count_f+=1\n", 169 | "for j in range(100):\n", 170 | " data = unfair(5)\n", 171 | " if np.sum(data)==5:\n", 172 | " count_unf+=1\n", 173 | " " 174 | ] 175 | }, 176 | { 177 | "cell_type": "code", 178 | "execution_count": 18, 179 | "metadata": { 180 | "ExecuteTime": { 181 | "end_time": "2021-03-04T16:22:02.084969Z", 182 | "start_time": "2021-03-04T16:22:02.065757Z" 183 | } 184 | }, 185 | "outputs": [ 186 | { 187 | "data": { 188 | "text/plain": [ 189 | "(0.06, 0.01)" 190 | ] 191 | }, 192 | "execution_count": 18, 193 | "metadata": {}, 194 | "output_type": "execute_result" 195 | } 196 | ], 197 | "source": [ 198 | "count_f/100,count_unf/10000" 199 | ] 200 | }, 201 | { 202 | "cell_type": "code", 203 | "execution_count": null, 204 | "metadata": {}, 205 | "outputs": [], 206 | "source": [] 207 | } 208 | ], 209 | "metadata": { 210 | "author": "g", 211 | "hide_input": false, 212 | "kernelspec": { 213 | "display_name": "Python 3", 214 | "language": "python", 215 | "name": "python3" 216 | }, 217 | "language_info": { 218 | "codemirror_mode": { 219 | "name": "ipython", 220 | "version": 3 221 | }, 222 | "file_extension": ".py", 223 | "mimetype": "text/x-python", 224 | "name": "python", 225 | "nbconvert_exporter": "python", 226 | "pygments_lexer": "ipython3", 227 | "version": "3.7.5" 228 | }, 229 | "latex_envs": { 230 | "LaTeX_envs_menu_present": true, 231 | "autoclose": false, 232 | "autocomplete": true, 233 | "bibliofile": "biblio.bib", 234 | "cite_by": "apalike", 235 | "current_citInitial": 1, 236 | "eqLabelWithNumbers": true, 237 | "eqNumInitial": 1, 238 | "hotkeys": { 239 | "equation": "Ctrl-E", 240 | "itemize": "Ctrl-I" 241 | }, 242 | "labels_anchors": false, 243 | "latex_user_defs": false, 244 | "report_style_numbering": false, 245 | "user_envs_cfg": false 246 | } 247 | }, 248 | "nbformat": 4, 249 | "nbformat_minor": 4 250 | } 251 | -------------------------------------------------------------------------------- /Which game would you choose March 9 2021.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "ExecuteTime": { 7 | "end_time": "2021-03-03T15:06:18.500645Z", 8 | "start_time": "2021-03-03T15:06:18.455823Z" 9 | } 10 | }, 11 | "source": [ 12 | "sergazy.nurbavliyev@gmail.com © 2021" 13 | ] 14 | }, 15 | { 16 | "cell_type": "markdown", 17 | "metadata": {}, 18 | "source": [ 19 | "## Which game would you choose " 20 | ] 21 | }, 22 | { 23 | "cell_type": "markdown", 24 | "metadata": {}, 25 | "source": [ 26 | "Question: Assume you and your friend decided to play the game in a casino. There are two games that you can play. \n", 27 | "Game 1. You roll two uniform fair dice. You can get the amount of dollars that is equivalent to the product of the numbers shown on both dies. \n", 28 | "Game 2. You roll one uniform fair die. You will get the dollar amount of the square of the value shown on the die. Which game will you choose? To be more clear: Which game has the higher expected value?" 29 | ] 30 | }, 31 | { 32 | "cell_type": "markdown", 33 | "metadata": {}, 34 | "source": [ 35 | "## Answer" 36 | ] 37 | }, 38 | { 39 | "cell_type": "markdown", 40 | "metadata": {}, 41 | "source": [ 42 | "Without calculating the real expected values. (This part is left to the reader.) We can stil answer the question.\n", 43 | " \n", 44 | "Let $X$ be the random variable that shows the outcome of the uniform fair die. Then the game 1 is asking to find $\\mathbb{E}[X]*\\mathbb{E}[X]$. In other words, the product of the expectation of the two independent rolls. However the game 2 is asking to find $\\mathbb{E}[X^2]$. In other words the expectation of the square of the single roll. Remember the definition of the variance. We know it is always non-negative. That is \n", 45 | "$Var(X)\\geq 0$.\n", 46 | "\\begin{equation}\n", 47 | "Var(X)=\\mathbb{E}[X^2]-\\mathbb{E}[X]^2\\geq 0\n", 48 | "\\end{equation}\n", 49 | "This implies that $\\mathbb{E}[X^2]\\geq \\mathbb{E}[X]^2$. Indeed, $\\mathbb{E}[X^2]> \\mathbb{E}[X]^2$ unless the two games are exactly the same. This implies that the second game has a higher expected value and we should choose that one." 50 | ] 51 | }, 52 | { 53 | "cell_type": "code", 54 | "execution_count": null, 55 | "metadata": {}, 56 | "outputs": [], 57 | "source": [] 58 | }, 59 | { 60 | "cell_type": "code", 61 | "execution_count": null, 62 | "metadata": {}, 63 | "outputs": [], 64 | "source": [] 65 | }, 66 | { 67 | "cell_type": "markdown", 68 | "metadata": {}, 69 | "source": [ 70 | "## Python code for exact value" 71 | ] 72 | }, 73 | { 74 | "cell_type": "code", 75 | "execution_count": 1, 76 | "metadata": { 77 | "ExecuteTime": { 78 | "end_time": "2021-03-10T05:35:05.365184Z", 79 | "start_time": "2021-03-10T05:35:04.552824Z" 80 | } 81 | }, 82 | "outputs": [], 83 | "source": [ 84 | "import sympy as S\n", 85 | "from sympy.stats import E, Die,variance\n", 86 | "x=Die('D1',6)\n", 87 | "y=Die('D2',6)" 88 | ] 89 | }, 90 | { 91 | "cell_type": "code", 92 | "execution_count": 2, 93 | "metadata": { 94 | "ExecuteTime": { 95 | "end_time": "2021-03-10T05:35:05.476554Z", 96 | "start_time": "2021-03-10T05:35:05.371494Z" 97 | } 98 | }, 99 | "outputs": [ 100 | { 101 | "data": { 102 | "text/plain": [ 103 | "(7/2, 91/6, 35/12)" 104 | ] 105 | }, 106 | "execution_count": 2, 107 | "metadata": {}, 108 | "output_type": "execute_result" 109 | } 110 | ], 111 | "source": [ 112 | "E(x),E(x**2),variance(x)" 113 | ] 114 | }, 115 | { 116 | "cell_type": "code", 117 | "execution_count": 3, 118 | "metadata": { 119 | "ExecuteTime": { 120 | "end_time": "2021-03-10T05:35:05.516596Z", 121 | "start_time": "2021-03-10T05:35:05.488862Z" 122 | } 123 | }, 124 | "outputs": [ 125 | { 126 | "data": { 127 | "text/plain": [ 128 | "(7/2, 91/6, 35/12)" 129 | ] 130 | }, 131 | "execution_count": 3, 132 | "metadata": {}, 133 | "output_type": "execute_result" 134 | } 135 | ], 136 | "source": [ 137 | "E(y),E(y**2),variance(y)" 138 | ] 139 | }, 140 | { 141 | "cell_type": "code", 142 | "execution_count": 4, 143 | "metadata": { 144 | "ExecuteTime": { 145 | "end_time": "2021-03-10T05:35:05.536319Z", 146 | "start_time": "2021-03-10T05:35:05.524363Z" 147 | } 148 | }, 149 | "outputs": [], 150 | "source": [ 151 | "z =x*y" 152 | ] 153 | }, 154 | { 155 | "cell_type": "code", 156 | "execution_count": 5, 157 | "metadata": { 158 | "ExecuteTime": { 159 | "end_time": "2021-03-10T05:35:05.714708Z", 160 | "start_time": "2021-03-10T05:35:05.545588Z" 161 | } 162 | }, 163 | "outputs": [ 164 | { 165 | "data": { 166 | "text/plain": [ 167 | "(49/4, 8281/36, 11515/144)" 168 | ] 169 | }, 170 | "execution_count": 5, 171 | "metadata": {}, 172 | "output_type": "execute_result" 173 | } 174 | ], 175 | "source": [ 176 | "E(z),E(z**2),variance(z)" 177 | ] 178 | }, 179 | { 180 | "cell_type": "code", 181 | "execution_count": 6, 182 | "metadata": { 183 | "ExecuteTime": { 184 | "end_time": "2021-03-10T05:35:05.773407Z", 185 | "start_time": "2021-03-10T05:35:05.723303Z" 186 | } 187 | }, 188 | "outputs": [ 189 | { 190 | "data": { 191 | "text/latex": [ 192 | "$\\displaystyle \\text{True}$" 193 | ], 194 | "text/plain": [ 195 | "True" 196 | ] 197 | }, 198 | "execution_count": 6, 199 | "metadata": {}, 200 | "output_type": "execute_result" 201 | } 202 | ], 203 | "source": [ 204 | "E(z)**2" 354 | ] 355 | }, 356 | "metadata": { 357 | "needs_background": "light" 358 | }, 359 | "output_type": "display_data" 360 | } 361 | ], 362 | "source": [ 363 | "from matplotlib import pyplot as plt\n", 364 | "plt.plot(trial_list)\n", 365 | "plt.axhline(y=0.7530894710825506, color='r', linestyle='-')\n", 366 | "plt.show()" 367 | ] 368 | }, 369 | { 370 | "cell_type": "markdown", 371 | "metadata": {}, 372 | "source": [ 373 | "\n", 374 | "For further discussions:\n", 375 | "https://www.quora.com/A-jar-has-1000-coins-of-which-999-are-fair-and-1-is-double-headed-Pick-a-coin-at-random-and-toss-it-10-times-Given-that-you-see-10-heads-what-is-the-probability-that-the-next-toss-of-that-coin-is-also-a-heads" 376 | ] 377 | }, 378 | { 379 | "cell_type": "code", 380 | "execution_count": null, 381 | "metadata": {}, 382 | "outputs": [], 383 | "source": [] 384 | } 385 | ], 386 | "metadata": { 387 | "author": "g", 388 | "hide_input": false, 389 | "kernelspec": { 390 | "display_name": "Python 3", 391 | "language": "python", 392 | "name": "python3" 393 | }, 394 | "language_info": { 395 | "codemirror_mode": { 396 | "name": "ipython", 397 | "version": 3 398 | }, 399 | "file_extension": ".py", 400 | "mimetype": "text/x-python", 401 | "name": "python", 402 | "nbconvert_exporter": "python", 403 | "pygments_lexer": "ipython3", 404 | "version": "3.7.5" 405 | }, 406 | "latex_envs": { 407 | "LaTeX_envs_menu_present": true, 408 | "autoclose": false, 409 | "autocomplete": true, 410 | "bibliofile": "biblio.bib", 411 | "cite_by": "apalike", 412 | "current_citInitial": 1, 413 | "eqLabelWithNumbers": true, 414 | "eqNumInitial": 1, 415 | "hotkeys": { 416 | "equation": "Ctrl-E", 417 | "itemize": "Ctrl-I" 418 | }, 419 | "labels_anchors": false, 420 | "latex_user_defs": false, 421 | "report_style_numbering": false, 422 | "user_envs_cfg": false 423 | } 424 | }, 425 | "nbformat": 4, 426 | "nbformat_minor": 4 427 | } 428 | --------------------------------------------------------------------------------