{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2026-04-06T14:01:22.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2026-04-06T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":44865,"title":"Efficiency of a single phase Transformer","description":"Calculate the efficiency of a single phase transformer whose KVA rating is A KVA, loading factor x,power factor p,full load copper loss Pcu Kilowatt, iron loss Pi Kilowatt. Efficiency = output power/input power","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 42px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 21px; transform-origin: 407px 21px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 380.5px 8px; transform-origin: 380.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eCalculate the efficiency of a single phase transformer whose KVA rating is A KVA, loading factor x,power factor p,full load copper loss Pcu Kilowatt, iron loss Pi Kilowatt. Efficiency = output power/input power\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = efficiency(A,x,p,Pcu,Pi)\r\n  y = A/(A+25*x);\r\nend","test_suite":"%%\r\nA=5; x=0.5; p=0.5; Pcu=0; Pi=0;\r\ny_correct = 1;\r\nassert(isequal(efficiency(A,x,p,Pcu,Pi),y_correct))\r\n\r\n%%\r\nA=1; x=1; p=1; Pcu=1; Pi=0;\r\ny_correct = 0.5;\r\nassert(isequal(efficiency(A,x,p,Pcu,Pi),y_correct))\r\n\r\n%%\r\nA=randi(10); x=randi(10); p=0; Pcu=randi(10); Pi=randi(10);\r\ny_correct = 0;\r\nassert(isequal(efficiency(A,x,p,Pcu,Pi),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":293792,"edited_by":223089,"edited_at":"2022-10-27T13:31:33.000Z","deleted_by":null,"deleted_at":null,"solvers_count":19,"test_suite_updated_at":"2022-10-27T13:31:33.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2019-03-07T06:31:45.000Z","updated_at":"2026-03-11T15:36:42.000Z","published_at":"2019-03-07T06:31:45.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCalculate the efficiency of a single phase transformer whose KVA rating is A KVA, loading factor x,power factor p,full load copper loss Pcu Kilowatt, iron loss Pi Kilowatt. Efficiency = output power/input power\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":61140,"title":"Calculating Swimming Stroke Index (SI)","description":"In competitive swimming, speed () is only one part of the equation. High efficiency is defined by moving fast while maintaining a high Distance Per Stroke (DPS). The Stroke Index (SI) is a common metric used by coaches to quantify this efficiency.\r\nYour task is to calculate the Stroke Index based on a single pool length. However, you must account for the glide distance after the wall push-off, as no strokes are taken during that phase.\r\n\r\nWhere:\r\n is the velocity over the entire length (m/s).\r\nDPS is the distance covered per stroke during the swimming phase only.\r\nConstraint:If the glide distance (pushOff) is greater than or equal to the pool length (poolLength), the scenario is physically impossible for this calculation. In such cases, the function must return NaN.\r\nInputs\r\npoolLength: Pool length in meters (e.g., 50).\r\ntime: Time taken to complete the length in seconds.\r\nstrokeCount: Total number of individual arm strokes taken.\r\npushOff: Glide distance (meters) covered before the first stroke begins.\r\nOutput\r\nSI: The Stroke Index rounded to two decimal place","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 483.562px; display: block; min-width: 0px; padding-block-start: 0px; padding-inline-start: 2px; padding-left: 2px; padding-top: 0px; perspective-origin: 408px 241.781px; transform-origin: 408px 241.781px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIn competitive swimming, speed (\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(33, 33, 33);\"\u003ev\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e) is only one part of the equation. High efficiency is defined by moving fast while maintaining a high \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eDistance Per Stroke (DPS)\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. The \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eStroke Index (SI)\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is a common metric used by coaches to quantify this efficiency.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eYour task is to calculate the Stroke Index based on a single pool length. However, you must account for the \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eglide distance\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e after the wall push-off, as no strokes are taken during that phase.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKQAAAAkCAYAAAAHBZGZAAAK6ElEQVR4Aeybe3BfRRXHf0lbm0pBGjtW0iZtHk201TKQaQXxkaAIMhSkWB0VdBBmsMjIKAqOQ6X1hYodX/hknMGW/kGFtAgihYqxigpSsAjB2jZNmrSaYII29mHapn6+l99u9t7fvb836S/1dvbknD179nX27Nmze38tT8T/Yg2UkAZigyyhxYiHkkjEBhlbQUlpIDbIklqOeDCxQcY2UFIaiA2ypJYjHkzpGmS8Nv+XGsjaIGtqaqbV1dUtnDNnzgW1tbULoF9lNDZ79uzWmTNnvtrkYxxrwGggV7vJaJANDQ31GOC6CRMmDB47duyJsrKyX9LZVuh/wX8IWFdeXv7opEmTFsL30owZM06C3wPsi4BVnmD8J2cNoM8FQDrdSud9yGzGafwAfANO5HWZOkKmAlnVU/0oeAKZNcjeAl6Qrs187EbtpTXI+vr66qNHjz6N4FKgEyO8FPxaePXQV0KfD6gsQX4rtJf6+vr279q1qxrj/SCMkx04CO8cym6AF6c8NIDungGq0fcVVHd1K3olvKuAL1D+LPAx6G+g8+cxoDWzZs2aST40dXV1HaLd05ANrpnW9tNUug74A3A5MivAW2nz5ubm5knQvpSv3aiRtAY5MjJyB0KaaAL6Iga9gUH37d69uxP6TsouAZT6u7u7/y7Chf379//azUN/qbOz8y/gOBWoAU4sGYfbynLWZhXwM+B7rM+1w8PD0xH4BaB0OafYZhmLMhEwwhH7UKDsc7T1Y9pcDVyPMbqe8YsDAwMfD8jLVvK2m0iDxC1X0JE8YIJBdGBwz5P3JWLHB2EMUf4YOCVNnTr1dJeJZzXKcdkxnYcG8H6uYSQw0PXBZvbs2TOAzuVJO5NldTiWTS0tLROT+RTU09PjWzMEHgFsSjqU7xsGa2+ckscq1G4iDZKOmrwe+MPkj4BSUnt7u/hbKH8ypRAGk28BmdQpz2oy4xiXxNDReaszkP4dO3Z0OHlLovMXyXwAMKkR56LQy+R9OLBmvXjFbT6BlzJuXy1VVVWvfImdkPMqyG4iDZIdN5AY/adbtb20jLI9qhflPOVRqX8uNCxk7jN0jIuigYtMKziPNuhjQGjCqP5EwRBg0vWGCGLWya4ZZSleF55iSl8s2tjYOCy+oFC7iTRIdlwvHfQDXmKgbXSsmMTLmz9M9gpijGDckcB1n4rMOYBJDxtiHOBywpFa4FLmcUvYZQB+C/B5brJzx3o+jOs0+rRHNsdyJt3KWH9PHZPcdTG8RFNT08kY97mGAb3R0C6G/zaTh16fPCk9VqF2E2mQXuuJxHeTWGjWkSNHNhL0TlMmE/AU9BZX5uDBg79186VK81wxn9vjdsbfCbSh8BVcBi4Ijhf+3cBKNuoDlE0AxizR79vdzhhDu5sPo6ljX0FUHuZcDh8+bA1NMsx7s7AL6OZi8tag2Qy6wMDypfztxtdMIDNlypSvw7KTZeJn4pIfnDdv3lT4aROy5zkCG/UU5OSzJvFA16KEqHexXPifyaZTdvhzeH09a51l5JlLs6Ed/Jsk3cj4GpL0mCA2infZTHb2WDJOTGbDEXPQJdUWYkg6wWxeBDLvEk7CI9u2bbPHPGv+Cub5Ycps6IX8V4lH9S4NezQVYjdpPWRHR8cwA1/C7nKD2LPwdvdogKNDCKVsjMPAUwYdWiOcKUXq6akgYAxTwpsP5xKGPM68vdgYA3hTUAq9XANPCzbEEboTeqxSOXOxcR5jzPblQse8HePkyZP/YTOjhF0zWK/HAH8ErAYeYM3/Ce+ngJJu7R9BRzcrE4RC7CatQaoj7T7es7RzFFOKJTj/wIED3xIRBixQLfw6wEt41V95RB5/UPjPqaadWRBwe7yHdnJKLPzvVAF8JtinK+kF3gvAw24MRT4ysbAXA3cDersrixRMU0DdN1D8GsCkTYZIRBPqyz3mhzCa/7jivE/Ky9s1Y85/o/wM9K/T4STwvfBWgN/L+jZxiqym/CgQmqSfXO1GDfmULEYY9Pb27sFLtFJmLzkMbBlBfUpshYzexCQrUtC/c+fO50TkA9TdweTXFAooyPXyWQ2FOf7VCBJbVhlamAV8M7iORboNnDFRfz5COu7eB76dUGQJOOdEf/bSQeUh3gU9Lw4dmRir+rZGTBt3BYXx+O90eENdXV3nofNFtD8f3Aq+Et5K8L3ZbsDe3tzsRv1nZZASlGGwQJeJNkD+JkO7mAm7Mc4GynTLA42vhFfdZUbMha7e0MKU6fPZOhbpceUzAReGRleG+gpBXFZWNDp3nYAMPNJLmQbp6/2GFqaNbwu7AM+GAfC1ZiPgglMudqPOUgyytrb2KsA+bkrIALtDR9hykwfz6O9/9YehrwDvpsxLTDT06cArLPE/jH2vGSInhPWQnAxaYF16bjTlmfD06dN1G9d7oEQ7MdD7ReQCyQdod7Nn1G3yVcSN9e7D4/keu5mP4vTFZizMO2O7RtZgbKYguzHtpBgkBdewo2wsQT6YfNf87du325+hSZBbl+Itu/vxLMHv2RLLGjjaxvSW7Q4MI7SBP17f+3lddXV1FQsmHXyUhe125dPRW7ZsOYz8ItqcC56rz3rp5MPKKioqFCbYInT7qM1EEPTnOhB9SflyUJS5ne3y2Cz5rFlBdmP6Dxqkgt+FTCLSIFFmH5V1uwQlhlDsoAgDLJYb42T1JGHqRmDtXhl4QYDSc7playwYnzu3afJQEydO3MAc16KHnC9JalNHGDjf49CN857hu7P14LSZkvBaSxnrJ00B9GJOOeOlDVtGqkurl0emI1O7nqD/T8F2Y5rzGSQL4D0NsHiRAXfyCJBxqA29/vviQ+q6sUjGHaxG0gEKOm637GTw7m0+5jWNp5I7NdZDhw4dr5/Pucdq5FOafhLGyfJZxroOMGkpxqiwweQtxgHpsdvkQ2VMYRjOwm4SmezGtOszSHa/F7hjBOdytQ/9AI+Mvcggd7tpSJgdOQP8VsBLlP/ZIwr4I4+CNzout+zksP8tzFzkac4mnLlk7969B8QbS+CWrsf6eaZPNsizhnYxa7BocHDwScpvTfL7GfMSdBjq0bmBNyBr2+W2/cdkvawRNlGQ3bgd+QwSpdvvsuyaNnbZp/iOW6kK+tRE/msM3hjkHe6OS+6A70jWAIqoMfQ4xsb4+nlPbSFGTvnd58s9Ny4dp6LL4PPSJ1iPD1H2HuAmDFEP2Po8qFu/vnPr3fhqxlzDmEN/JKFv16ynvsbZKWADbyTjswvyaRN18rabYMPBjvU0oVf42+jkKQa7iu+ZA0x2H4HuC+S9WyV4GTtumWmM8sVMXPGW3tgMW7HJNynbh7c9wzLHGYEe9BO7ITboO/isOJZfZDxNob/FjOFFdB48sRbCu4uy9YB+zV1NBcWHy8lfVllZWcca/YQx/xd+SsKYl/BwvY82fO1SdyV96r+nnJ5SKZqRl92ENRc0SL36X8hEbsT7NZeXl9cwQP1kXe7/Ogbfikuv5O3thzRm37+Qvx8oi4BTuru7n0Z+vKav4J2aCB1Cj8iXe1LoNJ1ujc6rkWsFrgb0q/w23erTjY31bUPW1A/iUyiTt03XhFuWl924DRjaZ5AMchMDsW9ULEIPvLXArfD1s/h2vnjoB5+m/gmPmftaNtSYH9PjSbHoqGh24zPI8aSEeKwnpgbG3CBPTDXGsyqWBmKDLJYm43aKooHYIIuixriRYmkgNshiaTJupygaiA2yKGqMGymWBv4HAAD//7yjBXMAAAAGSURBVAMAwsvilGz28nEAAAAASUVORK5CYII=\" width=\"82\" height=\"18\" alt=\"SI = v*DPS\" style=\"width: 82px; height: 18px;\"\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWhere:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 40.875px; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 391px 20.4375px; transform-origin: 391px 20.4375px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"block-size: 20.4375px; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2188px; text-align: left; transform-origin: 363px 10.2188px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"font-family: STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(33, 33, 33);\"\u003ev\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is the velocity over the \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eentire\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e length (\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003em/s\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e).\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4375px; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2188px; text-align: left; transform-origin: 363px 10.2188px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eDPS\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is the distance covered per stroke during the \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eswimming phase only\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\u003e\u003cdiv style=\"block-size: 43px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 21.5px; text-align: left; transform-origin: 384px 21.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eConstraint:\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIf the glide distance (\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003epushOff\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e) is greater than or equal to the pool length (\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003epoolLength\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e), the scenario is physically impossible for this calculation. In such cases, the function must return \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; font-weight: 700; \"\u003eNaN\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eInputs\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003col style=\"block-size: 83.75px; font-family: Helvetica, Arial, sans-serif; list-style-type: decimal; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 391px 41.875px; transform-origin: 391px 41.875px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"block-size: 20.9375px; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.4688px; text-align: left; transform-origin: 363px 10.4688px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003epoolLength\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e: Pool length in meters (e.g., 50).\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.9375px; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.4688px; text-align: left; transform-origin: 363px 10.4688px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003etime\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e: Time taken to complete the length in seconds.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.9375px; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.4688px; text-align: left; transform-origin: 363px 10.4688px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003estrokeCount\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e: Total number of individual arm strokes taken.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.9375px; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.4688px; text-align: left; transform-origin: 363px 10.4688px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003epushOff\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e: Glide distance (meters) covered before the first stroke begins.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ol\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eOutput\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 20.9375px; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 391px 10.4688px; transform-origin: 391px 10.4688px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.4688px; text-align: left; transform-origin: 363px 10.4688px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003eSI\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e: The Stroke Index rounded to \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003etwo decimal place\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function SI = calculateStrokeIndex(poolLength, time, strokeCount, pushOff)\r\n  SI = 1;\r\nend","test_suite":"%% Test Case 1:\r\nassert(isequal(calculateStrokeIndex(50, 35, 30, 5), 2.14));\r\n\r\n%% Test Case 2: Short Course Sprint\r\nassert(isequal(calculateStrokeIndex(25, 15, 12, 6), 2.64));\r\n\r\n%% Test Case 3:\r\nresult = calculateStrokeIndex(25, 10, 15, 30);\r\nassert(isnan(result), 'Function should return NaN when glide distance exceeds pool length');\r\n\r\n%% Test Case 4:\r\nresult = calculateStrokeIndex(50, 40, 20, 50);\r\nassert(isnan(result));\r\n\r\n%% Test Case 5:\r\nfor i = 1:5\r\n    L_rand = 50;\r\n    T_rand = 30 + rand*20;\r\n    S_rand = 20 + randi(20);\r\n    G_rand = rand*10;\r\n    \r\n    v = L_rand / T_rand;\r\n    DPS = (L_rand - G_rand) / S_rand;\r\n    expected = round(v * DPS, 2);\r\n    \r\n    assert(abs(calculateStrokeIndex(L_rand, T_rand, S_rand, G_rand) - expected) \u003c 1e-8);\r\nend","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":4996329,"edited_by":4996329,"edited_at":"2025-12-18T10:10:12.000Z","deleted_by":null,"deleted_at":null,"solvers_count":10,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2025-12-18T09:56:54.000Z","updated_at":"2026-02-26T10:57:38.000Z","published_at":"2025-12-18T10:03:46.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIn competitive swimming, speed (\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"v\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e$v$\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e) is only one part of the equation. High efficiency is defined by moving fast while maintaining a high \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eDistance Per Stroke (DPS)\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. The \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eStroke Index (SI)\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is a common metric used by coaches to quantify this efficiency.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYour task is to calculate the Stroke Index based on a single pool length. However, you must account for the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eglide distance\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e after the wall push-off, as no strokes are taken during that phase.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"true\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"SI = v*DPS\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e$$SI = v \\\\cdot DPS$$\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWhere:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"v\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e$v$\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e is the velocity over the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eentire\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e length (\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003em/s\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eDPS\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is the distance covered per stroke during the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eswimming phase only\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eConstraint:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003eIf the glide distance (\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003epushOff\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e) is greater than or equal to the pool length (\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003epoolLength\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e), the scenario is physically impossible for this calculation. In such cases, the function must return \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eNaN\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInputs\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003epoolLength\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e: Pool length in meters (e.g., 50).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003etime\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e: Time taken to complete the length in seconds.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003estrokeCount\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e: Total number of individual arm strokes taken.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003epushOff\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e: Glide distance (meters) covered before the first stroke begins.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eSI\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e: The Stroke Index rounded to \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003etwo decimal place\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":1940,"title":"Decimation - Optimized for speed","description":"This problem is similar to http://www.mathworks.com/matlabcentral/cody/problems/1092-decimation, only this time the score will be based on how quickly you can determine which person will survive.\r\n\r\nThe sample sizes (num_prisoners) and number of prisoners killed (num_killed) will be larger than in the original problem, but other than that the problem sets are identical.","description_html":"\u003cp\u003eThis problem is similar to \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1092-decimation\"\u003ehttp://www.mathworks.com/matlabcentral/cody/problems/1092-decimation\u003c/a\u003e, only this time the score will be based on how quickly you can determine which person will survive.\u003c/p\u003e\u003cp\u003eThe sample sizes (num_prisoners) and number of prisoners killed (num_killed) will be larger than in the original problem, but other than that the problem sets are identical.\u003c/p\u003e","function_template":"function y = speed_decimation(num_prisoners, num_killed)\r\n  y = num_prisoners+num_killed;\r\nend","test_suite":"%%\r\nassert(isequal(speed_decimation(10,3),4))\r\n%%\r\nassert(isequal(speed_decimation(1024,3),676))\r\n%%\r\nassert(isequal(speed_decimation(2012,50),543))\r\n%%\r\nassert(isequal(speed_decimation(30,5),3))\r\n%%\r\nassert(isequal(speed_decimation(10,10),8))\r\n%%\r\nassert(isequal(speed_decimation(2048,2),1))\r\n%%\r\nassert(isequal(speed_decimation(2048,1024),1773))\r\n%%\r\nt_in=clock;\r\nj=1:50;\r\nv=arrayfun(@(x) speed_decimation(100000,x),j);\r\ncorrect=[100000 68929 92620 32942 40333 54212 27152 67341 42610 77328 82991 13252 91717 6850 45758 71249 38339 86953 63331 66903 72606 83990 87828 46101 99979 47141 16871 60389 51549 76409 42868 78390 79590 27573 95835 53636 36954 39891 45943 63811 71589 70886 49313 4069 93694 96031 20739 41403 93714 60023];\r\nassert(all(isequal(v,correct)));\r\nt_out=etime(clock,t_in)*1000;\r\nfprintf('Actual Time = %.0f msec\\n',t_out)\r\nv=[100000:100000:1000000];\r\nv=arrayfun(@(x) speed_decimation(x,17),v);\r\ncorrect=[38339 162859 151602 99465 462955 559860 337009 546467 563784 364193];\r\nassert(all(isequal(v,correct)));\r\nt_out=etime(clock,t_in)*1000;\r\nfprintf('Actual Time = %.0f msec\\n',t_out)\r\nassert(isequal(speed_decimation(2^20,2^9),210856));\r\nt_out=etime(clock,t_in)*1000;\r\nt2=min(100000,t_out);\r\nfprintf('Actual Time = %.0f msec\\n',t_out)\r\nfeval(@assignin,'caller','score',floor(t2));","published":true,"deleted":false,"likes_count":9,"comments_count":2,"created_by":1615,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":224,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":13,"created_at":"2013-10-16T19:58:38.000Z","updated_at":"2026-04-08T14:54:11.000Z","published_at":"2013-10-16T19:58:38.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis problem is similar to\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/1092-decimation\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttp://www.mathworks.com/matlabcentral/cody/problems/1092-decimation\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, only this time the score will be based on how quickly you can determine which person will survive.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe sample sizes (num_prisoners) and number of prisoners killed (num_killed) will be larger than in the original problem, but other than that the problem sets are identical.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":44865,"title":"Efficiency of a single phase Transformer","description":"Calculate the efficiency of a single phase transformer whose KVA rating is A KVA, loading factor x,power factor p,full load copper loss Pcu Kilowatt, iron loss Pi Kilowatt. Efficiency = output power/input power","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 42px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 21px; transform-origin: 407px 21px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 380.5px 8px; transform-origin: 380.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eCalculate the efficiency of a single phase transformer whose KVA rating is A KVA, loading factor x,power factor p,full load copper loss Pcu Kilowatt, iron loss Pi Kilowatt. Efficiency = output power/input power\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = efficiency(A,x,p,Pcu,Pi)\r\n  y = A/(A+25*x);\r\nend","test_suite":"%%\r\nA=5; x=0.5; p=0.5; Pcu=0; Pi=0;\r\ny_correct = 1;\r\nassert(isequal(efficiency(A,x,p,Pcu,Pi),y_correct))\r\n\r\n%%\r\nA=1; x=1; p=1; Pcu=1; Pi=0;\r\ny_correct = 0.5;\r\nassert(isequal(efficiency(A,x,p,Pcu,Pi),y_correct))\r\n\r\n%%\r\nA=randi(10); x=randi(10); p=0; Pcu=randi(10); Pi=randi(10);\r\ny_correct = 0;\r\nassert(isequal(efficiency(A,x,p,Pcu,Pi),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":293792,"edited_by":223089,"edited_at":"2022-10-27T13:31:33.000Z","deleted_by":null,"deleted_at":null,"solvers_count":19,"test_suite_updated_at":"2022-10-27T13:31:33.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2019-03-07T06:31:45.000Z","updated_at":"2026-03-11T15:36:42.000Z","published_at":"2019-03-07T06:31:45.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCalculate the efficiency of a single phase transformer whose KVA rating is A KVA, loading factor x,power factor p,full load copper loss Pcu Kilowatt, iron loss Pi Kilowatt. Efficiency = output power/input power\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":61140,"title":"Calculating Swimming Stroke Index (SI)","description":"In competitive swimming, speed () is only one part of the equation. High efficiency is defined by moving fast while maintaining a high Distance Per Stroke (DPS). The Stroke Index (SI) is a common metric used by coaches to quantify this efficiency.\r\nYour task is to calculate the Stroke Index based on a single pool length. However, you must account for the glide distance after the wall push-off, as no strokes are taken during that phase.\r\n\r\nWhere:\r\n is the velocity over the entire length (m/s).\r\nDPS is the distance covered per stroke during the swimming phase only.\r\nConstraint:If the glide distance (pushOff) is greater than or equal to the pool length (poolLength), the scenario is physically impossible for this calculation. In such cases, the function must return NaN.\r\nInputs\r\npoolLength: Pool length in meters (e.g., 50).\r\ntime: Time taken to complete the length in seconds.\r\nstrokeCount: Total number of individual arm strokes taken.\r\npushOff: Glide distance (meters) covered before the first stroke begins.\r\nOutput\r\nSI: The Stroke Index rounded to two decimal place","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 483.562px; display: block; min-width: 0px; padding-block-start: 0px; padding-inline-start: 2px; padding-left: 2px; padding-top: 0px; perspective-origin: 408px 241.781px; transform-origin: 408px 241.781px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIn competitive swimming, speed (\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(33, 33, 33);\"\u003ev\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e) is only one part of the equation. High efficiency is defined by moving fast while maintaining a high \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eDistance Per Stroke (DPS)\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. The \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eStroke Index (SI)\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is a common metric used by coaches to quantify this efficiency.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eYour task is to calculate the Stroke Index based on a single pool length. However, you must account for the \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eglide distance\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e after the wall push-off, as no strokes are taken during that phase.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,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\" width=\"82\" height=\"18\" alt=\"SI = v*DPS\" style=\"width: 82px; height: 18px;\"\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWhere:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 40.875px; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 391px 20.4375px; transform-origin: 391px 20.4375px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"block-size: 20.4375px; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2188px; text-align: left; transform-origin: 363px 10.2188px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"font-family: STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(33, 33, 33);\"\u003ev\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is the velocity over the \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eentire\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e length (\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003em/s\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e).\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4375px; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2188px; text-align: left; transform-origin: 363px 10.2188px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eDPS\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is the distance covered per stroke during the \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eswimming phase only\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\u003e\u003cdiv style=\"block-size: 43px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 21.5px; text-align: left; transform-origin: 384px 21.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eConstraint:\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIf the glide distance (\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003epushOff\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e) is greater than or equal to the pool length (\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003epoolLength\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e), the scenario is physically impossible for this calculation. In such cases, the function must return \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; font-weight: 700; \"\u003eNaN\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eInputs\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003col style=\"block-size: 83.75px; font-family: Helvetica, Arial, sans-serif; list-style-type: decimal; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 391px 41.875px; transform-origin: 391px 41.875px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"block-size: 20.9375px; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.4688px; text-align: left; transform-origin: 363px 10.4688px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003epoolLength\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e: Pool length in meters (e.g., 50).\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.9375px; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.4688px; text-align: left; transform-origin: 363px 10.4688px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003etime\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e: Time taken to complete the length in seconds.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.9375px; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.4688px; text-align: left; transform-origin: 363px 10.4688px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003estrokeCount\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e: Total number of individual arm strokes taken.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.9375px; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.4688px; text-align: left; transform-origin: 363px 10.4688px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003epushOff\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e: Glide distance (meters) covered before the first stroke begins.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ol\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eOutput\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 20.9375px; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 391px 10.4688px; transform-origin: 391px 10.4688px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.4688px; text-align: left; transform-origin: 363px 10.4688px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003eSI\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e: The Stroke Index rounded to \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003etwo decimal place\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function SI = calculateStrokeIndex(poolLength, time, strokeCount, pushOff)\r\n  SI = 1;\r\nend","test_suite":"%% Test Case 1:\r\nassert(isequal(calculateStrokeIndex(50, 35, 30, 5), 2.14));\r\n\r\n%% Test Case 2: Short Course Sprint\r\nassert(isequal(calculateStrokeIndex(25, 15, 12, 6), 2.64));\r\n\r\n%% Test Case 3:\r\nresult = calculateStrokeIndex(25, 10, 15, 30);\r\nassert(isnan(result), 'Function should return NaN when glide distance exceeds pool length');\r\n\r\n%% Test Case 4:\r\nresult = calculateStrokeIndex(50, 40, 20, 50);\r\nassert(isnan(result));\r\n\r\n%% Test Case 5:\r\nfor i = 1:5\r\n    L_rand = 50;\r\n    T_rand = 30 + rand*20;\r\n    S_rand = 20 + randi(20);\r\n    G_rand = rand*10;\r\n    \r\n    v = L_rand / T_rand;\r\n    DPS = (L_rand - G_rand) / S_rand;\r\n    expected = round(v * DPS, 2);\r\n    \r\n    assert(abs(calculateStrokeIndex(L_rand, T_rand, S_rand, G_rand) - expected) \u003c 1e-8);\r\nend","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":4996329,"edited_by":4996329,"edited_at":"2025-12-18T10:10:12.000Z","deleted_by":null,"deleted_at":null,"solvers_count":10,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2025-12-18T09:56:54.000Z","updated_at":"2026-02-26T10:57:38.000Z","published_at":"2025-12-18T10:03:46.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIn competitive swimming, speed (\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"v\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e$v$\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e) is only one part of the equation. High efficiency is defined by moving fast while maintaining a high \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eDistance Per Stroke (DPS)\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. The \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eStroke Index (SI)\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is a common metric used by coaches to quantify this efficiency.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYour task is to calculate the Stroke Index based on a single pool length. However, you must account for the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eglide distance\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e after the wall push-off, as no strokes are taken during that phase.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"true\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"SI = v*DPS\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e$$SI = v \\\\cdot DPS$$\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWhere:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"v\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e$v$\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e is the velocity over the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eentire\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e length (\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003em/s\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eDPS\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is the distance covered per stroke during the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eswimming phase only\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eConstraint:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003eIf the glide distance (\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003epushOff\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e) is greater than or equal to the pool length (\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003epoolLength\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e), the scenario is physically impossible for this calculation. In such cases, the function must return \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eNaN\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInputs\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003epoolLength\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e: Pool length in meters (e.g., 50).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003etime\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e: Time taken to complete the length in seconds.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003estrokeCount\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e: Total number of individual arm strokes taken.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003epushOff\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e: Glide distance (meters) covered before the first stroke begins.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eSI\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e: The Stroke Index rounded to \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003etwo decimal place\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":1940,"title":"Decimation - Optimized for speed","description":"This problem is similar to http://www.mathworks.com/matlabcentral/cody/problems/1092-decimation, only this time the score will be based on how quickly you can determine which person will survive.\r\n\r\nThe sample sizes (num_prisoners) and number of prisoners killed (num_killed) will be larger than in the original problem, but other than that the problem sets are identical.","description_html":"\u003cp\u003eThis problem is similar to \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1092-decimation\"\u003ehttp://www.mathworks.com/matlabcentral/cody/problems/1092-decimation\u003c/a\u003e, only this time the score will be based on how quickly you can determine which person will survive.\u003c/p\u003e\u003cp\u003eThe sample sizes (num_prisoners) and number of prisoners killed (num_killed) will be larger than in the original problem, but other than that the problem sets are identical.\u003c/p\u003e","function_template":"function y = speed_decimation(num_prisoners, num_killed)\r\n  y = num_prisoners+num_killed;\r\nend","test_suite":"%%\r\nassert(isequal(speed_decimation(10,3),4))\r\n%%\r\nassert(isequal(speed_decimation(1024,3),676))\r\n%%\r\nassert(isequal(speed_decimation(2012,50),543))\r\n%%\r\nassert(isequal(speed_decimation(30,5),3))\r\n%%\r\nassert(isequal(speed_decimation(10,10),8))\r\n%%\r\nassert(isequal(speed_decimation(2048,2),1))\r\n%%\r\nassert(isequal(speed_decimation(2048,1024),1773))\r\n%%\r\nt_in=clock;\r\nj=1:50;\r\nv=arrayfun(@(x) speed_decimation(100000,x),j);\r\ncorrect=[100000 68929 92620 32942 40333 54212 27152 67341 42610 77328 82991 13252 91717 6850 45758 71249 38339 86953 63331 66903 72606 83990 87828 46101 99979 47141 16871 60389 51549 76409 42868 78390 79590 27573 95835 53636 36954 39891 45943 63811 71589 70886 49313 4069 93694 96031 20739 41403 93714 60023];\r\nassert(all(isequal(v,correct)));\r\nt_out=etime(clock,t_in)*1000;\r\nfprintf('Actual Time = %.0f msec\\n',t_out)\r\nv=[100000:100000:1000000];\r\nv=arrayfun(@(x) speed_decimation(x,17),v);\r\ncorrect=[38339 162859 151602 99465 462955 559860 337009 546467 563784 364193];\r\nassert(all(isequal(v,correct)));\r\nt_out=etime(clock,t_in)*1000;\r\nfprintf('Actual Time = %.0f msec\\n',t_out)\r\nassert(isequal(speed_decimation(2^20,2^9),210856));\r\nt_out=etime(clock,t_in)*1000;\r\nt2=min(100000,t_out);\r\nfprintf('Actual Time = %.0f msec\\n',t_out)\r\nfeval(@assignin,'caller','score',floor(t2));","published":true,"deleted":false,"likes_count":9,"comments_count":2,"created_by":1615,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":224,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":13,"created_at":"2013-10-16T19:58:38.000Z","updated_at":"2026-04-08T14:54:11.000Z","published_at":"2013-10-16T19:58:38.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis problem is similar to\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/1092-decimation\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttp://www.mathworks.com/matlabcentral/cody/problems/1092-decimation\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, only this time the score will be based on how quickly you can determine which person will survive.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe sample sizes (num_prisoners) and number of prisoners killed (num_killed) will be larger than in the original problem, but other than that the problem sets are identical.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"term":"tag:\"efficiency\"","current_player_id":null,"fields":[{"name":"page","type":"integer","callback":null,"default":1,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"per_page","type":"integer","callback":null,"default":50,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"sort","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"body","type":"text","callback":null,"default":"*:*","directive":null,"facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":false},{"name":"group","type":"string","callback":null,"default":null,"directive":"group","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"difficulty_rating_bin","type":"string","callback":null,"default":null,"directive":"difficulty_rating_bin","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"id","type":"integer","callback":null,"default":null,"directive":"id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"tag","type":"string","callback":null,"default":null,"directive":"tag","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"product","type":"string","callback":null,"default":null,"directive":"product","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_at","type":"timeframe","callback":{},"default":null,"directive":"created_at","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"profile_id","type":"integer","callback":null,"default":null,"directive":"author_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_by","type":"string","callback":null,"default":null,"directive":"author","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player_id","type":"integer","callback":null,"default":null,"directive":"solver_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player","type":"string","callback":null,"default":null,"directive":"solver","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"solvers_count","type":"integer","callback":null,"default":null,"directive":"solvers_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"comments_count","type":"integer","callback":null,"default":null,"directive":"comments_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"likes_count","type":"integer","callback":null,"default":null,"directive":"likes_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leader_id","type":"integer","callback":null,"default":null,"directive":"leader_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leading_solution","type":"integer","callback":null,"default":null,"directive":"leading_solution","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true}],"filters":[{"name":"asset_type","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":"\"cody:problem\"","prepend":true},{"name":"profile_id","type":"integer","callback":{},"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":"author_id","static":null,"prepend":true}],"query":{"params":{"per_page":50,"term":"tag:\"efficiency\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"efficiency\"","","\"","efficiency","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f5e8a511a40\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f5e8a5119a0\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f5e8a510b40\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f5e8a511d60\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f5e8a511cc0\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f5e8a511c20\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f5e8a511b80\u003e":"tag:\"efficiency\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f5e8a511b80\u003e":"tag:\"efficiency\""},"queried_facets":{}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"cody-search","password":"78X075ddcV44","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"tag:\"efficiency\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"efficiency\"","","\"","efficiency","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f5e8a511a40\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f5e8a5119a0\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f5e8a510b40\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f5e8a511d60\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f5e8a511cc0\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f5e8a511c20\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f5e8a511b80\u003e":"tag:\"efficiency\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f5e8a511b80\u003e":"tag:\"efficiency\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":44865,"difficulty_rating":"easy"},{"id":61140,"difficulty_rating":"easy-medium"},{"id":1940,"difficulty_rating":"medium-hard"}]}}