aepstar commited on
Commit
a70d5f6
Β·
1 Parent(s): 5ceb796
cw001evenodd.html CHANGED
@@ -230,6 +230,12 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
230
  <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
231
  <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
232
  </div>
 
 
 
 
 
 
233
  </li>
234
  </ul>
235
  </li>
@@ -272,7 +278,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
272
  </header>
273
 
274
  <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Tantangan #1/366 - 15 Feb 2024</p>
275
- <p><a href="https://www.codewars.com/kata/53da3dbb4a5168369a0000fe/train/r" class="uri">https://www.codewars.com/kata/53da3dbb4a5168369a0000fe/train/r</a></p>
276
  <section id="instruction" class="level2" data-number="1.1">
277
  <h2 data-number="1.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">1.1</span> Instruction</h2>
278
  <p>Create a function that takes an integer as an argument and returns <code>"Even"</code> for even numbers or <code>"Odd"</code> for odd numbers.</p>
@@ -308,31 +314,31 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
308
  <span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">even_or_odd</span>(<span class="dv">1</span>), <span class="st">"Odd"</span>)</span>
309
  <span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
310
  <div class="cell-output cell-output-stdout">
311
- <pre><code>Test passed πŸ˜€</code></pre>
312
  </div>
313
  <div class="sourceCode cell-code" id="cb6"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="fu">test_that</span>(<span class="st">'even_or_odd(2) returns "Even"'</span>, {</span>
314
  <span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">even_or_odd</span>(<span class="dv">2</span>), <span class="st">"Even"</span>)</span>
315
  <span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
316
  <div class="cell-output cell-output-stdout">
317
- <pre><code>Test passed 🎊</code></pre>
318
  </div>
319
  <div class="sourceCode cell-code" id="cb8"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="fu">test_that</span>(<span class="st">'even_or_odd(0) returns "Even"'</span>, {</span>
320
  <span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">even_or_odd</span>(<span class="dv">0</span>), <span class="st">"Even"</span>)</span>
321
  <span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
322
  <div class="cell-output cell-output-stdout">
323
- <pre><code>Test passed πŸ₯³</code></pre>
324
  </div>
325
  <div class="sourceCode cell-code" id="cb10"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="fu">test_that</span>(<span class="st">'even_or_odd(-1) returns "Odd"'</span>, {</span>
326
  <span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">even_or_odd</span>(<span class="sc">-</span><span class="dv">1</span>), <span class="st">"Odd"</span>)</span>
327
  <span id="cb10-3"><a href="#cb10-3" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
328
  <div class="cell-output cell-output-stdout">
329
- <pre><code>Test passed 🌈</code></pre>
330
  </div>
331
  <div class="sourceCode cell-code" id="cb12"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="fu">test_that</span>(<span class="st">'even_or_odd(-2) returns "Even"'</span>, {</span>
332
  <span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">even_or_odd</span>(<span class="sc">-</span><span class="dv">2</span>), <span class="st">"Even"</span>)</span>
333
  <span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
334
  <div class="cell-output cell-output-stdout">
335
- <pre><code>Test passed 🎊</code></pre>
336
  </div>
337
  </div>
338
  </section>
 
230
  <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
231
  <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
232
  </div>
233
+ </li>
234
+ <li class="sidebar-item">
235
+ <div class="sidebar-item-container">
236
+ <a href="./cw013repeat_string.html" class="sidebar-item-text sidebar-link">
237
+ <span class="menu-text"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">String repeat</span></span></a>
238
+ </div>
239
  </li>
240
  </ul>
241
  </li>
 
278
  </header>
279
 
280
  <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Tantangan #1/366 - 15 Feb 2024</p>
281
+ <p><a href="https://www.codewars.com/kata/53da3dbb4a5168369a0000fe" class="uri">https://www.codewars.com/kata/53da3dbb4a5168369a0000fe</a></p>
282
  <section id="instruction" class="level2" data-number="1.1">
283
  <h2 data-number="1.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">1.1</span> Instruction</h2>
284
  <p>Create a function that takes an integer as an argument and returns <code>"Even"</code> for even numbers or <code>"Odd"</code> for odd numbers.</p>
 
314
  <span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">even_or_odd</span>(<span class="dv">1</span>), <span class="st">"Odd"</span>)</span>
315
  <span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
316
  <div class="cell-output cell-output-stdout">
317
+ <pre><code>Test passed πŸŽ‰</code></pre>
318
  </div>
319
  <div class="sourceCode cell-code" id="cb6"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="fu">test_that</span>(<span class="st">'even_or_odd(2) returns "Even"'</span>, {</span>
320
  <span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">even_or_odd</span>(<span class="dv">2</span>), <span class="st">"Even"</span>)</span>
321
  <span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
322
  <div class="cell-output cell-output-stdout">
323
+ <pre><code>Test passed 🌈</code></pre>
324
  </div>
325
  <div class="sourceCode cell-code" id="cb8"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="fu">test_that</span>(<span class="st">'even_or_odd(0) returns "Even"'</span>, {</span>
326
  <span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">even_or_odd</span>(<span class="dv">0</span>), <span class="st">"Even"</span>)</span>
327
  <span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
328
  <div class="cell-output cell-output-stdout">
329
+ <pre><code>Test passed πŸ₯‡</code></pre>
330
  </div>
331
  <div class="sourceCode cell-code" id="cb10"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="fu">test_that</span>(<span class="st">'even_or_odd(-1) returns "Odd"'</span>, {</span>
332
  <span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">even_or_odd</span>(<span class="sc">-</span><span class="dv">1</span>), <span class="st">"Odd"</span>)</span>
333
  <span id="cb10-3"><a href="#cb10-3" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
334
  <div class="cell-output cell-output-stdout">
335
+ <pre><code>Test passed 😸</code></pre>
336
  </div>
337
  <div class="sourceCode cell-code" id="cb12"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="fu">test_that</span>(<span class="st">'even_or_odd(-2) returns "Even"'</span>, {</span>
338
  <span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">even_or_odd</span>(<span class="sc">-</span><span class="dv">2</span>), <span class="st">"Even"</span>)</span>
339
  <span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
340
  <div class="cell-output cell-output-stdout">
341
+ <pre><code>Test passed 😸</code></pre>
342
  </div>
343
  </div>
344
  </section>
cw002multiply.html CHANGED
@@ -230,6 +230,12 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
230
  <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
231
  <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
232
  </div>
 
 
 
 
 
 
233
  </li>
234
  </ul>
235
  </li>
@@ -272,7 +278,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
272
  </header>
273
 
274
  <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Tantangan #2/366 - 16 Feb 2024</p>
275
- <p><a href="https://www.codewars.com/kata/50654ddff44f800200000004/train/r" class="uri">https://www.codewars.com/kata/50654ddff44f800200000004/train/r</a></p>
276
  <section id="instruction" class="level2" data-number="2.1">
277
  <h2 data-number="2.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">2.1</span> Instruction</h2>
278
  <p>This code does not execute properly. Try to figure out why.</p>
 
230
  <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
231
  <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
232
  </div>
233
+ </li>
234
+ <li class="sidebar-item">
235
+ <div class="sidebar-item-container">
236
+ <a href="./cw013repeat_string.html" class="sidebar-item-text sidebar-link">
237
+ <span class="menu-text"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">String repeat</span></span></a>
238
+ </div>
239
  </li>
240
  </ul>
241
  </li>
 
278
  </header>
279
 
280
  <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Tantangan #2/366 - 16 Feb 2024</p>
281
+ <p><a href="https://www.codewars.com/kata/50654ddff44f800200000004" class="uri">https://www.codewars.com/kata/50654ddff44f800200000004</a></p>
282
  <section id="instruction" class="level2" data-number="2.1">
283
  <h2 data-number="2.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">2.1</span> Instruction</h2>
284
  <p>This code does not execute properly. Try to figure out why.</p>
cw003countsheep.html CHANGED
@@ -230,6 +230,12 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
230
  <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
231
  <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
232
  </div>
 
 
 
 
 
 
233
  </li>
234
  </ul>
235
  </li>
@@ -272,7 +278,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
272
  </header>
273
 
274
  <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Tantangan #3/366 - 17 Feb 2024</p>
275
- <p><a href="https://www.codewars.com/kata/5b077ebdaf15be5c7f000077/train/r" class="uri">https://www.codewars.com/kata/5b077ebdaf15be5c7f000077/train/r</a></p>
276
  <section id="instruction" class="level2" data-number="3.1">
277
  <h2 data-number="3.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">3.1</span> Instruction</h2>
278
  <p>Given a non-negative integer, 3 for example, return a string with a murmur: β€œ1 sheep…2 sheep…3 sheep…”. Input will always be valid, i.e.&nbsp;no negative integers.</p>
@@ -316,7 +322,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
316
  <span id="cb3-7"><a href="#cb3-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">countSheep</span>(<span class="dv">3</span>), <span class="st">"1 sheep...2 sheep...3 sheep..."</span>)</span>
317
  <span id="cb3-8"><a href="#cb3-8" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
318
  <div class="cell-output cell-output-stdout">
319
- <pre><code>Test passed πŸ₯³</code></pre>
320
  </div>
321
  </div>
322
  </section>
 
230
  <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
231
  <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
232
  </div>
233
+ </li>
234
+ <li class="sidebar-item">
235
+ <div class="sidebar-item-container">
236
+ <a href="./cw013repeat_string.html" class="sidebar-item-text sidebar-link">
237
+ <span class="menu-text"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">String repeat</span></span></a>
238
+ </div>
239
  </li>
240
  </ul>
241
  </li>
 
278
  </header>
279
 
280
  <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Tantangan #3/366 - 17 Feb 2024</p>
281
+ <p><a href="https://www.codewars.com/kata/5b077ebdaf15be5c7f000077" class="uri">https://www.codewars.com/kata/5b077ebdaf15be5c7f000077</a></p>
282
  <section id="instruction" class="level2" data-number="3.1">
283
  <h2 data-number="3.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">3.1</span> Instruction</h2>
284
  <p>Given a non-negative integer, 3 for example, return a string with a murmur: β€œ1 sheep…2 sheep…3 sheep…”. Input will always be valid, i.e.&nbsp;no negative integers.</p>
 
322
  <span id="cb3-7"><a href="#cb3-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">countSheep</span>(<span class="dv">3</span>), <span class="st">"1 sheep...2 sheep...3 sheep..."</span>)</span>
323
  <span id="cb3-8"><a href="#cb3-8" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
324
  <div class="cell-output cell-output-stdout">
325
+ <pre><code>Test passed 😸</code></pre>
326
  </div>
327
  </div>
328
  </section>
cw004reducegrow.html CHANGED
@@ -230,6 +230,12 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
230
  <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
231
  <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
232
  </div>
 
 
 
 
 
 
233
  </li>
234
  </ul>
235
  </li>
@@ -272,7 +278,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
272
  </header>
273
 
274
  <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Tantangan #4/366 - 18 Feb 2024</p>
275
- <p><a href="https://www.codewars.com/kata/57f780909f7e8e3183000078/train/r" class="uri">https://www.codewars.com/kata/57f780909f7e8e3183000078/train/r</a></p>
276
  <section id="instruction" class="level2" data-number="4.1">
277
  <h2 data-number="4.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">4.1</span> Instruction</h2>
278
  <p>Given a non-empty array of integers, return the result of multiplying the values together in order. Example:</p>
@@ -310,7 +316,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
310
  <span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">grow</span>(<span class="fu">c</span>(<span class="dv">2</span>, <span class="dv">2</span>, <span class="dv">2</span>, <span class="dv">2</span>, <span class="dv">2</span>, <span class="dv">2</span>)), <span class="dv">64</span>)</span>
311
  <span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
312
  <div class="cell-output cell-output-stdout">
313
- <pre><code>Test passed πŸŽ‰</code></pre>
314
  </div>
315
  </div>
316
  </section>
 
230
  <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
231
  <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
232
  </div>
233
+ </li>
234
+ <li class="sidebar-item">
235
+ <div class="sidebar-item-container">
236
+ <a href="./cw013repeat_string.html" class="sidebar-item-text sidebar-link">
237
+ <span class="menu-text"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">String repeat</span></span></a>
238
+ </div>
239
  </li>
240
  </ul>
241
  </li>
 
278
  </header>
279
 
280
  <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Tantangan #4/366 - 18 Feb 2024</p>
281
+ <p><a href="https://www.codewars.com/kata/57f780909f7e8e3183000078" class="uri">https://www.codewars.com/kata/57f780909f7e8e3183000078</a></p>
282
  <section id="instruction" class="level2" data-number="4.1">
283
  <h2 data-number="4.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">4.1</span> Instruction</h2>
284
  <p>Given a non-empty array of integers, return the result of multiplying the values together in order. Example:</p>
 
316
  <span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">grow</span>(<span class="fu">c</span>(<span class="dv">2</span>, <span class="dv">2</span>, <span class="dv">2</span>, <span class="dv">2</span>, <span class="dv">2</span>, <span class="dv">2</span>)), <span class="dv">64</span>)</span>
317
  <span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
318
  <div class="cell-output cell-output-stdout">
319
+ <pre><code>Test passed 🌈</code></pre>
320
  </div>
321
  </div>
322
  </section>
cw005make_negative.html CHANGED
@@ -230,6 +230,12 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
230
  <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
231
  <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
232
  </div>
 
 
 
 
 
 
233
  </li>
234
  </ul>
235
  </li>
@@ -272,7 +278,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
272
  </header>
273
 
274
  <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Tantangan #5/366 - 19 Feb 2024</p>
275
- <p><a href="https://www.codewars.com/kata/55685cd7ad70877c23000102/train/r" class="uri">https://www.codewars.com/kata/55685cd7ad70877c23000102/train/r</a></p>
276
  <section id="instruction" class="level2" data-number="5.1">
277
  <h2 data-number="5.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">5.1</span> Instruction</h2>
278
  <p>In this simple assignment you are given a number and have to make it negative. But maybe the number is already negative?</p>
 
230
  <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
231
  <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
232
  </div>
233
+ </li>
234
+ <li class="sidebar-item">
235
+ <div class="sidebar-item-container">
236
+ <a href="./cw013repeat_string.html" class="sidebar-item-text sidebar-link">
237
+ <span class="menu-text"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">String repeat</span></span></a>
238
+ </div>
239
  </li>
240
  </ul>
241
  </li>
 
278
  </header>
279
 
280
  <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Tantangan #5/366 - 19 Feb 2024</p>
281
+ <p><a href="https://www.codewars.com/kata/55685cd7ad70877c23000102" class="uri">https://www.codewars.com/kata/55685cd7ad70877c23000102</a></p>
282
  <section id="instruction" class="level2" data-number="5.1">
283
  <h2 data-number="5.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">5.1</span> Instruction</h2>
284
  <p>In this simple assignment you are given a number and have to make it negative. But maybe the number is already negative?</p>
cw006positive_sum.html CHANGED
@@ -230,6 +230,12 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
230
  <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
231
  <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
232
  </div>
 
 
 
 
 
 
233
  </li>
234
  </ul>
235
  </li>
@@ -272,7 +278,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
272
  </header>
273
 
274
  <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Tantangan #6/366 - 20 Feb 2024</p>
275
- <p><a href="https://www.codewars.com/kata/5715eaedb436cf5606000381/train/r" class="uri">https://www.codewars.com/kata/5715eaedb436cf5606000381/train/r</a></p>
276
  <section id="instruction" class="level2" data-number="6.1">
277
  <h2 data-number="6.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">6.1</span> Instruction</h2>
278
  <p>You get an array of numbers, return the sum of all of the positives ones.</p>
@@ -323,7 +329,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
323
  <span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">positive_sum</span>(<span class="fu">c</span>(<span class="sc">-</span><span class="dv">1</span>,<span class="sc">-</span><span class="dv">2</span>,<span class="sc">-</span><span class="dv">3</span>,<span class="sc">-</span><span class="dv">4</span>,<span class="sc">-</span><span class="dv">5</span>)),<span class="dv">0</span>)</span>
324
  <span id="cb4-9"><a href="#cb4-9" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
325
  <div class="cell-output cell-output-stdout">
326
- <pre><code>Test passed 🎊</code></pre>
327
  </div>
328
  </div>
329
  </section>
 
230
  <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
231
  <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
232
  </div>
233
+ </li>
234
+ <li class="sidebar-item">
235
+ <div class="sidebar-item-container">
236
+ <a href="./cw013repeat_string.html" class="sidebar-item-text sidebar-link">
237
+ <span class="menu-text"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">String repeat</span></span></a>
238
+ </div>
239
  </li>
240
  </ul>
241
  </li>
 
278
  </header>
279
 
280
  <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Tantangan #6/366 - 20 Feb 2024</p>
281
+ <p><a href="https://www.codewars.com/kata/5715eaedb436cf5606000381" class="uri">https://www.codewars.com/kata/5715eaedb436cf5606000381</a></p>
282
  <section id="instruction" class="level2" data-number="6.1">
283
  <h2 data-number="6.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">6.1</span> Instruction</h2>
284
  <p>You get an array of numbers, return the sum of all of the positives ones.</p>
 
329
  <span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">positive_sum</span>(<span class="fu">c</span>(<span class="sc">-</span><span class="dv">1</span>,<span class="sc">-</span><span class="dv">2</span>,<span class="sc">-</span><span class="dv">3</span>,<span class="sc">-</span><span class="dv">4</span>,<span class="sc">-</span><span class="dv">5</span>)),<span class="dv">0</span>)</span>
330
  <span id="cb4-9"><a href="#cb4-9" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
331
  <div class="cell-output cell-output-stdout">
332
+ <pre><code>Test passed πŸ˜€</code></pre>
333
  </div>
334
  </div>
335
  </section>
cw007reversedstrings.html CHANGED
@@ -230,6 +230,12 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
230
  <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
231
  <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
232
  </div>
 
 
 
 
 
 
233
  </li>
234
  </ul>
235
  </li>
@@ -272,7 +278,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
272
  </header>
273
 
274
  <p>Tantangan #7/366 - 21 Feb 2024</p>
275
- <p><a href="https://www.codewars.com/kata/5168bb5dfe9a00b126000018/train/r" class="uri">https://www.codewars.com/kata/5168bb5dfe9a00b126000018/train/r</a></p>
276
  <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Reversed Strings</p>
277
  <section id="instruction" class="level2" data-number="7.1">
278
  <h2 data-number="7.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">7.1</span> Instruction</h2>
@@ -311,7 +317,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
311
  <span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">solution</span>(<span class="st">'h'</span>), <span class="st">'h'</span>)</span>
312
  <span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
313
  <div class="cell-output cell-output-stdout">
314
- <pre><code>Test passed πŸ₯‡</code></pre>
315
  </div>
316
  </div>
317
  </section>
 
230
  <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
231
  <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
232
  </div>
233
+ </li>
234
+ <li class="sidebar-item">
235
+ <div class="sidebar-item-container">
236
+ <a href="./cw013repeat_string.html" class="sidebar-item-text sidebar-link">
237
+ <span class="menu-text"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">String repeat</span></span></a>
238
+ </div>
239
  </li>
240
  </ul>
241
  </li>
 
278
  </header>
279
 
280
  <p>Tantangan #7/366 - 21 Feb 2024</p>
281
+ <p><a href="https://www.codewars.com/kata/5168bb5dfe9a00b126000018" class="uri">https://www.codewars.com/kata/5168bb5dfe9a00b126000018</a></p>
282
  <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Reversed Strings</p>
283
  <section id="instruction" class="level2" data-number="7.1">
284
  <h2 data-number="7.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">7.1</span> Instruction</h2>
 
317
  <span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">solution</span>(<span class="st">'h'</span>), <span class="st">'h'</span>)</span>
318
  <span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
319
  <div class="cell-output cell-output-stdout">
320
+ <pre><code>Test passed πŸŽ‰</code></pre>
321
  </div>
322
  </div>
323
  </section>
cw008bool_to_word.html CHANGED
@@ -230,6 +230,12 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
230
  <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
231
  <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
232
  </div>
 
 
 
 
 
 
233
  </li>
234
  </ul>
235
  </li>
@@ -272,7 +278,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
272
  </header>
273
 
274
  <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Tantangan #8/366 - 22 Feb 2024</p>
275
- <p><a href="https://www.codewars.com/kata/53369039d7ab3ac506000467/train/r" class="uri">https://www.codewars.com/kata/53369039d7ab3ac506000467/train/r</a></p>
276
  <section id="instruction" class="level2" data-number="8.1">
277
  <h2 data-number="8.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">8.1</span> Instruction</h2>
278
  <p>Complete the method that takes a boolean value and return a <code>"Yes"</code> string for <code>true</code>, or a <code>"No"</code> string for <code>false</code>.</p>
@@ -300,7 +306,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
300
  <span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">bool_to_word</span>(<span class="cn">FALSE</span>), <span class="st">'No'</span>)</span>
301
  <span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
302
  <div class="cell-output cell-output-stdout">
303
- <pre><code>Test passed πŸ₯³</code></pre>
304
  </div>
305
  </div>
306
  </section>
 
230
  <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
231
  <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
232
  </div>
233
+ </li>
234
+ <li class="sidebar-item">
235
+ <div class="sidebar-item-container">
236
+ <a href="./cw013repeat_string.html" class="sidebar-item-text sidebar-link">
237
+ <span class="menu-text"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">String repeat</span></span></a>
238
+ </div>
239
  </li>
240
  </ul>
241
  </li>
 
278
  </header>
279
 
280
  <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Tantangan #8/366 - 22 Feb 2024</p>
281
+ <p><a href="https://www.codewars.com/kata/53369039d7ab3ac506000467" class="uri">https://www.codewars.com/kata/53369039d7ab3ac506000467</a></p>
282
  <section id="instruction" class="level2" data-number="8.1">
283
  <h2 data-number="8.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">8.1</span> Instruction</h2>
284
  <p>Complete the method that takes a boolean value and return a <code>"Yes"</code> string for <code>true</code>, or a <code>"No"</code> string for <code>false</code>.</p>
 
306
  <span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">bool_to_word</span>(<span class="cn">FALSE</span>), <span class="st">'No'</span>)</span>
307
  <span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
308
  <div class="cell-output cell-output-stdout">
309
+ <pre><code>Test passed 🌈</code></pre>
310
  </div>
311
  </div>
312
  </section>
cw009number_to_string.html CHANGED
@@ -230,6 +230,12 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
230
  <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
231
  <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
232
  </div>
 
 
 
 
 
 
233
  </li>
234
  </ul>
235
  </li>
@@ -272,7 +278,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
272
  </header>
273
 
274
  <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Tantangan #9/366 - 23 Feb 2024</p>
275
- <p><a href="https://www.codewars.com/kata/5265326f5fda8eb1160004c8/train/r" class="uri">https://www.codewars.com/kata/5265326f5fda8eb1160004c8/train/r</a></p>
276
  <section id="instruction" class="level2" data-number="9.1">
277
  <h2 data-number="9.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">9.1</span> Instruction</h2>
278
  <p>We need a function that can transform a number (integer) into a string.</p>
@@ -309,7 +315,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
309
  <span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">number_to_string</span>(<span class="sc">-</span><span class="dv">1</span>), <span class="st">'-1'</span>)</span>
310
  <span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
311
  <div class="cell-output cell-output-stdout">
312
- <pre><code>Test passed πŸ˜€</code></pre>
313
  </div>
314
  </div>
315
  </section>
 
230
  <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
231
  <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
232
  </div>
233
+ </li>
234
+ <li class="sidebar-item">
235
+ <div class="sidebar-item-container">
236
+ <a href="./cw013repeat_string.html" class="sidebar-item-text sidebar-link">
237
+ <span class="menu-text"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">String repeat</span></span></a>
238
+ </div>
239
  </li>
240
  </ul>
241
  </li>
 
278
  </header>
279
 
280
  <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Tantangan #9/366 - 23 Feb 2024</p>
281
+ <p><a href="https://www.codewars.com/kata/5265326f5fda8eb1160004c8" class="uri">https://www.codewars.com/kata/5265326f5fda8eb1160004c8</a></p>
282
  <section id="instruction" class="level2" data-number="9.1">
283
  <h2 data-number="9.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">9.1</span> Instruction</h2>
284
  <p>We need a function that can transform a number (integer) into a string.</p>
 
315
  <span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">number_to_string</span>(<span class="sc">-</span><span class="dv">1</span>), <span class="st">'-1'</span>)</span>
316
  <span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
317
  <div class="cell-output cell-output-stdout">
318
+ <pre><code>Test passed πŸ₯‡</code></pre>
319
  </div>
320
  </div>
321
  </section>
cw010opposite.html CHANGED
@@ -230,6 +230,12 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
230
  <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
231
  <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
232
  </div>
 
 
 
 
 
 
233
  </li>
234
  </ul>
235
  </li>
@@ -272,7 +278,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
272
  </header>
273
 
274
  <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Tantangan #10/366 - 24 Feb 2024</p>
275
- <p><a href="https://www.codewars.com/kata/56dec885c54a926dcd001095/train/r" class="uri">https://www.codewars.com/kata/56dec885c54a926dcd001095/train/r</a></p>
276
  <section id="instruction" class="level2" data-number="10.1">
277
  <h2 data-number="10.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">10.1</span> Instruction</h2>
278
  <p>Very simple, given a number (integer / decimal / both depending on the language), find its opposite (additive inverse).</p>
@@ -305,25 +311,25 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
305
  <span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">opposite</span>(<span class="dv">1</span>), <span class="sc">-</span><span class="dv">1</span>)</span>
306
  <span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
307
  <div class="cell-output cell-output-stdout">
308
- <pre><code>Test passed πŸ₯‡</code></pre>
309
  </div>
310
  <div class="sourceCode cell-code" id="cb6"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="fu">test_that</span>(<span class="st">"the opposite of 0 is 0"</span>, {</span>
311
  <span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">opposite</span>(<span class="dv">0</span>), <span class="dv">0</span>)</span>
312
  <span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
313
  <div class="cell-output cell-output-stdout">
314
- <pre><code>Test passed πŸŽ‰</code></pre>
315
  </div>
316
  <div class="sourceCode cell-code" id="cb8"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="fu">test_that</span>(<span class="st">"the opposite of positive 3.14 is negative 3.14"</span>, {</span>
317
  <span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">opposite</span>(<span class="fl">3.14</span>), <span class="sc">-</span><span class="fl">3.14</span>)</span>
318
  <span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
319
  <div class="cell-output cell-output-stdout">
320
- <pre><code>Test passed πŸ˜€</code></pre>
321
  </div>
322
  <div class="sourceCode cell-code" id="cb10"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="fu">test_that</span>(<span class="st">"the opposite of negative 400.2 is positive 400.2"</span>, {</span>
323
  <span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">opposite</span>(<span class="sc">-</span><span class="fl">400.2</span>), <span class="fl">400.2</span>)</span>
324
  <span id="cb10-3"><a href="#cb10-3" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
325
  <div class="cell-output cell-output-stdout">
326
- <pre><code>Test passed πŸ˜€</code></pre>
327
  </div>
328
  </div>
329
  </section>
 
230
  <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
231
  <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
232
  </div>
233
+ </li>
234
+ <li class="sidebar-item">
235
+ <div class="sidebar-item-container">
236
+ <a href="./cw013repeat_string.html" class="sidebar-item-text sidebar-link">
237
+ <span class="menu-text"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">String repeat</span></span></a>
238
+ </div>
239
  </li>
240
  </ul>
241
  </li>
 
278
  </header>
279
 
280
  <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Tantangan #10/366 - 24 Feb 2024</p>
281
+ <p><a href="https://www.codewars.com/kata/56dec885c54a926dcd001095" class="uri">https://www.codewars.com/kata/56dec885c54a926dcd001095</a></p>
282
  <section id="instruction" class="level2" data-number="10.1">
283
  <h2 data-number="10.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">10.1</span> Instruction</h2>
284
  <p>Very simple, given a number (integer / decimal / both depending on the language), find its opposite (additive inverse).</p>
 
311
  <span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">opposite</span>(<span class="dv">1</span>), <span class="sc">-</span><span class="dv">1</span>)</span>
312
  <span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
313
  <div class="cell-output cell-output-stdout">
314
+ <pre><code>Test passed 😸</code></pre>
315
  </div>
316
  <div class="sourceCode cell-code" id="cb6"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="fu">test_that</span>(<span class="st">"the opposite of 0 is 0"</span>, {</span>
317
  <span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">opposite</span>(<span class="dv">0</span>), <span class="dv">0</span>)</span>
318
  <span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
319
  <div class="cell-output cell-output-stdout">
320
+ <pre><code>Test passed 🎊</code></pre>
321
  </div>
322
  <div class="sourceCode cell-code" id="cb8"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="fu">test_that</span>(<span class="st">"the opposite of positive 3.14 is negative 3.14"</span>, {</span>
323
  <span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">opposite</span>(<span class="fl">3.14</span>), <span class="sc">-</span><span class="fl">3.14</span>)</span>
324
  <span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
325
  <div class="cell-output cell-output-stdout">
326
+ <pre><code>Test passed πŸŽ‰</code></pre>
327
  </div>
328
  <div class="sourceCode cell-code" id="cb10"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="fu">test_that</span>(<span class="st">"the opposite of negative 400.2 is positive 400.2"</span>, {</span>
329
  <span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">opposite</span>(<span class="sc">-</span><span class="fl">400.2</span>), <span class="fl">400.2</span>)</span>
330
  <span id="cb10-3"><a href="#cb10-3" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
331
  <div class="cell-output cell-output-stdout">
332
+ <pre><code>Test passed πŸ₯‡</code></pre>
333
  </div>
334
  </div>
335
  </section>
cw011removeChar.html CHANGED
@@ -230,6 +230,12 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
230
  <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
231
  <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
232
  </div>
 
 
 
 
 
 
233
  </li>
234
  </ul>
235
  </li>
@@ -272,7 +278,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
272
  </header>
273
 
274
  <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Tantangan #11/366 - 25 Feb 2024</p>
275
- <p><a href="https://www.codewars.com/kata/56bc28ad5bdaeb48760009b0/train/r" class="uri">https://www.codewars.com/kata/56bc28ad5bdaeb48760009b0/train/r</a></p>
276
  <section id="instruction" class="level2" data-number="11.1">
277
  <h2 data-number="11.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">11.1</span> Instruction</h2>
278
  <p>It’s pretty straightforward. Your goal is to create a function that removes the first and last characters of a string. You’re given one parameter, the original string. You don’t have to worry about strings with less than two characters.</p>
 
230
  <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
231
  <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
232
  </div>
233
+ </li>
234
+ <li class="sidebar-item">
235
+ <div class="sidebar-item-container">
236
+ <a href="./cw013repeat_string.html" class="sidebar-item-text sidebar-link">
237
+ <span class="menu-text"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">String repeat</span></span></a>
238
+ </div>
239
  </li>
240
  </ul>
241
  </li>
 
278
  </header>
279
 
280
  <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Tantangan #11/366 - 25 Feb 2024</p>
281
+ <p><a href="https://www.codewars.com/kata/56bc28ad5bdaeb48760009b0" class="uri">https://www.codewars.com/kata/56bc28ad5bdaeb48760009b0</a></p>
282
  <section id="instruction" class="level2" data-number="11.1">
283
  <h2 data-number="11.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">11.1</span> Instruction</h2>
284
  <p>It’s pretty straightforward. Your goal is to create a function that removes the first and last characters of a string. You’re given one parameter, the original string. You don’t have to worry about strings with less than two characters.</p>
cw012square_sum.html CHANGED
@@ -64,6 +64,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
64
  <script src="site_libs/quarto-search/fuse.min.js"></script>
65
  <script src="site_libs/quarto-search/quarto-search.js"></script>
66
  <meta name="quarto:offset" content="./">
 
67
  <link href="./cw011removeChar.html" rel="prev">
68
  <link href="./logo.png" rel="icon" type="image/png">
69
  <script src="site_libs/quarto-html/quarto.js"></script>
@@ -245,6 +246,12 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
245
  <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link active">
246
  <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
247
  </div>
 
 
 
 
 
 
248
  </li>
249
  </ul>
250
  </li>
@@ -287,7 +294,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
287
  </header>
288
 
289
  <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Tantangan #12/366 - 26 Feb 2024</p>
290
- <p><a href="https://www.codewars.com/kata/515e271a311df0350d00000f/train/r" class="uri">https://www.codewars.com/kata/515e271a311df0350d00000f/train/r</a></p>
291
  <section id="instruction" class="level2" data-number="12.1">
292
  <h2 data-number="12.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">12.1</span> Instruction</h2>
293
  <p>Complete the square sum function so that it squares each number passed into it and then sums the results together.</p>
@@ -326,7 +333,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
326
  <span id="cb3-8"><a href="#cb3-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">square_sum</span>(<span class="fu">c</span>(<span class="sc">-</span><span class="dv">1</span>, <span class="dv">0</span>, <span class="dv">1</span>)), <span class="dv">2</span>)</span>
327
  <span id="cb3-9"><a href="#cb3-9" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
328
  <div class="cell-output cell-output-stdout">
329
- <pre><code>Test passed πŸŽ‰</code></pre>
330
  </div>
331
  </div>
332
  </section>
@@ -583,6 +590,9 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
583
  </a>
584
  </div>
585
  <div class="nav-page nav-page-next">
 
 
 
586
  </div>
587
  </nav>
588
  </div> <!-- /content -->
 
64
  <script src="site_libs/quarto-search/fuse.min.js"></script>
65
  <script src="site_libs/quarto-search/quarto-search.js"></script>
66
  <meta name="quarto:offset" content="./">
67
+ <link href="./cw013repeat_string.html" rel="next">
68
  <link href="./cw011removeChar.html" rel="prev">
69
  <link href="./logo.png" rel="icon" type="image/png">
70
  <script src="site_libs/quarto-html/quarto.js"></script>
 
246
  <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link active">
247
  <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
248
  </div>
249
+ </li>
250
+ <li class="sidebar-item">
251
+ <div class="sidebar-item-container">
252
+ <a href="./cw013repeat_string.html" class="sidebar-item-text sidebar-link">
253
+ <span class="menu-text"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">String repeat</span></span></a>
254
+ </div>
255
  </li>
256
  </ul>
257
  </li>
 
294
  </header>
295
 
296
  <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Tantangan #12/366 - 26 Feb 2024</p>
297
+ <p><a href="https://www.codewars.com/kata/515e271a311df0350d00000f" class="uri">https://www.codewars.com/kata/515e271a311df0350d00000f</a></p>
298
  <section id="instruction" class="level2" data-number="12.1">
299
  <h2 data-number="12.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">12.1</span> Instruction</h2>
300
  <p>Complete the square sum function so that it squares each number passed into it and then sums the results together.</p>
 
333
  <span id="cb3-8"><a href="#cb3-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">square_sum</span>(<span class="fu">c</span>(<span class="sc">-</span><span class="dv">1</span>, <span class="dv">0</span>, <span class="dv">1</span>)), <span class="dv">2</span>)</span>
334
  <span id="cb3-9"><a href="#cb3-9" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
335
  <div class="cell-output cell-output-stdout">
336
+ <pre><code>Test passed 😸</code></pre>
337
  </div>
338
  </div>
339
  </section>
 
590
  </a>
591
  </div>
592
  <div class="nav-page nav-page-next">
593
+ <a href="./cw013repeat_string.html" class="pagination-link">
594
+ <span class="nav-page-text"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">String repeat</span></span> <i class="bi bi-arrow-right-short"></i>
595
+ </a>
596
  </div>
597
  </nav>
598
  </div> <!-- /content -->
feb.html β†’ cw013repeat_string.html RENAMED
@@ -7,7 +7,7 @@
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
8
 
9
 
10
- <title>Codewars Challenge 2024 Menggunakan R dan RStudio - Februari</title>
11
  <style>
12
  code{white-space: pre-wrap;}
13
  span.smallcaps{font-variant: small-caps;}
@@ -20,6 +20,40 @@ ul.task-list li input[type="checkbox"] {
20
  margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
21
  vertical-align: middle;
22
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  </style>
24
 
25
 
@@ -30,8 +64,7 @@ ul.task-list li input[type="checkbox"] {
30
  <script src="site_libs/quarto-search/fuse.min.js"></script>
31
  <script src="site_libs/quarto-search/quarto-search.js"></script>
32
  <meta name="quarto:offset" content="./">
33
- <link href="./cw001evenodd.html" rel="next">
34
- <link href="./index.html" rel="prev">
35
  <link href="./logo.png" rel="icon" type="image/png">
36
  <script src="site_libs/quarto-html/quarto.js"></script>
37
  <script src="site_libs/quarto-html/popper.min.js"></script>
@@ -42,6 +75,7 @@ ul.task-list li input[type="checkbox"] {
42
  <script src="site_libs/bootstrap/bootstrap.min.js"></script>
43
  <link href="site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
44
  <link href="site_libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
 
45
  <script id="quarto-search-options" type="application/json">{
46
  "location": "sidebar",
47
  "copy-button": false,
@@ -64,8 +98,12 @@ ul.task-list li input[type="checkbox"] {
64
  }</script>
65
 
66
 
67
- <meta name="twitter:title" content="Codewars Challenge 2024 Menggunakan R dan RStudio - Februari">
68
- <meta name="twitter:card" content="summary">
 
 
 
 
69
  </head>
70
 
71
  <body class="nav-sidebar floating">
@@ -77,7 +115,7 @@ ul.task-list li input[type="checkbox"] {
77
  <button type="button" class="quarto-btn-toggle btn" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
78
  <i class="bi bi-layout-text-sidebar-reverse"></i>
79
  </button>
80
- <nav class="quarto-page-breadcrumbs" aria-label="breadcrumb"><ol class="breadcrumb"><li class="breadcrumb-item"><a href="./feb.html">Februari</a></li></ol></nav>
81
  <a class="flex-grow-1" role="button" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
82
  </a>
83
  <button type="button" class="btn quarto-search-button" aria-label="" onclick="window.quartoOpenSearch();">
@@ -113,7 +151,7 @@ ul.task-list li input[type="checkbox"] {
113
  </li>
114
  <li class="sidebar-item sidebar-item-section">
115
  <div class="sidebar-item-container">
116
- <a href="./feb.html" class="sidebar-item-text sidebar-link active">
117
  <span class="menu-text">Februari</span></a>
118
  <a class="sidebar-item-toggle text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" aria-expanded="true" aria-label="Toggle section">
119
  <i class="bi bi-chevron-right ms-2"></i>
@@ -191,6 +229,12 @@ ul.task-list li input[type="checkbox"] {
191
  <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
192
  <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
193
  </div>
 
 
 
 
 
 
194
  </li>
195
  </ul>
196
  </li>
@@ -200,14 +244,24 @@ ul.task-list li input[type="checkbox"] {
200
  <div id="quarto-sidebar-glass" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass"></div>
201
  <!-- margin-sidebar -->
202
  <div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
203
-
 
 
 
 
 
 
 
 
 
 
204
  </div>
205
  <!-- main -->
206
  <main class="content" id="quarto-document-content">
207
 
208
  <header id="title-block-header" class="quarto-title-block default">
209
  <div class="quarto-title">
210
- <h1 class="title">Februari</h1>
211
  </div>
212
 
213
 
@@ -222,8 +276,67 @@ ul.task-list li input[type="checkbox"] {
222
 
223
  </header>
224
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
 
226
 
 
227
 
228
  </main> <!-- /main -->
229
  <script id="quarto-html-after-body" type="application/javascript">
@@ -461,14 +574,11 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
461
  </script>
462
  <nav class="page-navigation">
463
  <div class="nav-page nav-page-previous">
464
- <a href="./index.html" class="pagination-link">
465
- <i class="bi bi-arrow-left-short"></i> <span class="nav-page-text">Pengantar</span>
466
  </a>
467
  </div>
468
  <div class="nav-page nav-page-next">
469
- <a href="./cw001evenodd.html" class="pagination-link">
470
- <span class="nav-page-text"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Even or Odd</span></span> <i class="bi bi-arrow-right-short"></i>
471
- </a>
472
  </div>
473
  </nav>
474
  </div> <!-- /content -->
 
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
8
 
9
 
10
+ <title>Codewars Challenge 2024 Menggunakan R dan RStudio - 13&nbsp; String repeat</title>
11
  <style>
12
  code{white-space: pre-wrap;}
13
  span.smallcaps{font-variant: small-caps;}
 
20
  margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
21
  vertical-align: middle;
22
  }
23
+ /* CSS for syntax highlighting */
24
+ pre > code.sourceCode { white-space: pre; position: relative; }
25
+ pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
26
+ pre > code.sourceCode > span:empty { height: 1.2em; }
27
+ .sourceCode { overflow: visible; }
28
+ code.sourceCode > span { color: inherit; text-decoration: inherit; }
29
+ div.sourceCode { margin: 1em 0; }
30
+ pre.sourceCode { margin: 0; }
31
+ @media screen {
32
+ div.sourceCode { overflow: auto; }
33
+ }
34
+ @media print {
35
+ pre > code.sourceCode { white-space: pre-wrap; }
36
+ pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
37
+ }
38
+ pre.numberSource code
39
+ { counter-reset: source-line 0; }
40
+ pre.numberSource code > span
41
+ { position: relative; left: -4em; counter-increment: source-line; }
42
+ pre.numberSource code > span > a:first-child::before
43
+ { content: counter(source-line);
44
+ position: relative; left: -1em; text-align: right; vertical-align: baseline;
45
+ border: none; display: inline-block;
46
+ -webkit-touch-callout: none; -webkit-user-select: none;
47
+ -khtml-user-select: none; -moz-user-select: none;
48
+ -ms-user-select: none; user-select: none;
49
+ padding: 0 4px; width: 4em;
50
+ }
51
+ pre.numberSource { margin-left: 3em; padding-left: 4px; }
52
+ div.sourceCode
53
+ { }
54
+ @media screen {
55
+ pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
56
+ }
57
  </style>
58
 
59
 
 
64
  <script src="site_libs/quarto-search/fuse.min.js"></script>
65
  <script src="site_libs/quarto-search/quarto-search.js"></script>
66
  <meta name="quarto:offset" content="./">
67
+ <link href="./cw012square_sum.html" rel="prev">
 
68
  <link href="./logo.png" rel="icon" type="image/png">
69
  <script src="site_libs/quarto-html/quarto.js"></script>
70
  <script src="site_libs/quarto-html/popper.min.js"></script>
 
75
  <script src="site_libs/bootstrap/bootstrap.min.js"></script>
76
  <link href="site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
77
  <link href="site_libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
78
+ <link href="site_libs/quarto-contrib/badge/badge.css" rel="stylesheet">
79
  <script id="quarto-search-options" type="application/json">{
80
  "location": "sidebar",
81
  "copy-button": false,
 
98
  }</script>
99
 
100
 
101
+ <meta name="twitter:title" content="Codewars Challenge 2024 Menggunakan R dan RStudio - 13&nbsp; String repeat">
102
+ <meta name="twitter:description" content="">
103
+ <meta name="twitter:image" content="https://huggingface.co/spaces/aephidayatuloh/codewars2024/new_starcore_logo.png">
104
+ <meta name="twitter:image-height" content="434">
105
+ <meta name="twitter:image-width" content="1946">
106
+ <meta name="twitter:card" content="summary_large_image">
107
  </head>
108
 
109
  <body class="nav-sidebar floating">
 
115
  <button type="button" class="quarto-btn-toggle btn" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
116
  <i class="bi bi-layout-text-sidebar-reverse"></i>
117
  </button>
118
+ <nav class="quarto-page-breadcrumbs" aria-label="breadcrumb"><ol class="breadcrumb"><li class="breadcrumb-item"><a href="./cw001evenodd.html">Februari</a></li><li class="breadcrumb-item"><a href="./cw013repeat_string.html"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">String repeat</span></a></li></ol></nav>
119
  <a class="flex-grow-1" role="button" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
120
  </a>
121
  <button type="button" class="btn quarto-search-button" aria-label="" onclick="window.quartoOpenSearch();">
 
151
  </li>
152
  <li class="sidebar-item sidebar-item-section">
153
  <div class="sidebar-item-container">
154
+ <a class="sidebar-item-text sidebar-link text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" aria-expanded="true">
155
  <span class="menu-text">Februari</span></a>
156
  <a class="sidebar-item-toggle text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" aria-expanded="true" aria-label="Toggle section">
157
  <i class="bi bi-chevron-right ms-2"></i>
 
229
  <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
230
  <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
231
  </div>
232
+ </li>
233
+ <li class="sidebar-item">
234
+ <div class="sidebar-item-container">
235
+ <a href="./cw013repeat_string.html" class="sidebar-item-text sidebar-link active">
236
+ <span class="menu-text"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">String repeat</span></span></a>
237
+ </div>
238
  </li>
239
  </ul>
240
  </li>
 
244
  <div id="quarto-sidebar-glass" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass"></div>
245
  <!-- margin-sidebar -->
246
  <div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
247
+ <nav id="TOC" role="doc-toc" class="toc-active">
248
+ <h2 id="toc-title">Table of contents</h2>
249
+
250
+ <ul>
251
+ <li><a href="#instruction" id="toc-instruction" class="nav-link active" data-scroll-target="#instruction"><span class="header-section-number">13.1</span> Instruction</a></li>
252
+ <li><a href="#youtube-video" id="toc-youtube-video" class="nav-link" data-scroll-target="#youtube-video"><span class="header-section-number">13.2</span> YouTube Video</a></li>
253
+ <li><a href="#solution-code" id="toc-solution-code" class="nav-link" data-scroll-target="#solution-code"><span class="header-section-number">13.3</span> Solution Code</a></li>
254
+ <li><a href="#test" id="toc-test" class="nav-link" data-scroll-target="#test"><span class="header-section-number">13.4</span> Test</a></li>
255
+ <li><a href="#supported-by" id="toc-supported-by" class="nav-link" data-scroll-target="#supported-by"><span class="header-section-number">13.5</span> Supported by</a></li>
256
+ </ul>
257
+ </nav>
258
  </div>
259
  <!-- main -->
260
  <main class="content" id="quarto-document-content">
261
 
262
  <header id="title-block-header" class="quarto-title-block default">
263
  <div class="quarto-title">
264
+ <h1 class="title"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">String repeat</span></h1>
265
  </div>
266
 
267
 
 
276
 
277
  </header>
278
 
279
+ <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Tantangan #13/366 - 27 Feb 2024</p>
280
+ <p><a href="https://www.codewars.com/kata/57a0e5c372292dd76d000d7e" class="uri">https://www.codewars.com/kata/57a0e5c372292dd76d000d7e</a></p>
281
+ <section id="instruction" class="level2" data-number="13.1">
282
+ <h2 data-number="13.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">13.1</span> Instruction</h2>
283
+ <p>Write a function that accepts an integer <code>n</code> and a string <code>s</code> as parameters, and returns a string of <code>s</code> repeated exactly <code>n</code> times.</p>
284
+ <p><strong>Examples (input -&gt; output)</strong></p>
285
+ <div class="cell">
286
+ <div class="sourceCode cell-code" id="cb1"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="dv">6</span>, <span class="st">"I"</span> <span class="ot">-&gt;</span> <span class="st">"IIIIII"</span></span>
287
+ <span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="dv">5</span>, <span class="st">"Hello"</span> <span class="ot">-&gt;</span> <span class="st">"HelloHelloHelloHelloHello"</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
288
+ </div>
289
+ </section>
290
+ <section id="youtube-video" class="level2" data-number="13.2">
291
+ <h2 data-number="13.2" class="anchored" data-anchor-id="youtube-video"><span class="header-section-number">13.2</span> YouTube Video</h2>
292
+ <div class="quarto-video ratio ratio-16x9"><iframe data-external="1" src="https://www.youtube.com/embed/L8aczEhqymk?si=DSx84acpNvbkucrK" title="" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe></div>
293
+ </section>
294
+ <section id="solution-code" class="level2" data-number="13.3">
295
+ <h2 data-number="13.3" class="anchored" data-anchor-id="solution-code"><span class="header-section-number">13.3</span> Solution Code</h2>
296
+ <div class="cell">
297
+ <div class="sourceCode cell-code" id="cb2"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>repeat_string <span class="ot">&lt;-</span> <span class="cf">function</span>(count, str) {</span>
298
+ <span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> str_c <span class="ot">&lt;-</span> str</span>
299
+ <span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span>(i <span class="cf">in</span> <span class="dv">2</span><span class="sc">:</span>count){</span>
300
+ <span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a> str_c <span class="ot">&lt;-</span> <span class="fu">paste0</span>(str_c, str)</span>
301
+ <span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a> }</span>
302
+ <span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">return</span>(str_c)</span>
303
+ <span id="cb2-7"><a href="#cb2-7" aria-hidden="true" tabindex="-1"></a>}</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
304
+ </div>
305
+ <div class="cell">
306
+ <div class="sourceCode cell-code" id="cb3"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a>repeat_string <span class="ot">&lt;-</span> <span class="cf">function</span>(count, str) {</span>
307
+ <span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">paste</span>(<span class="fu">rep</span>(str, count), <span class="at">collapse =</span> <span class="st">""</span>)</span>
308
+ <span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a>}</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
309
+ </div>
310
+ <div class="cell">
311
+ <div class="sourceCode cell-code" id="cb4"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a>repeat_string <span class="ot">&lt;-</span> <span class="cf">function</span>(count, str) <span class="fu">strrep</span>(str, count)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
312
+ </div>
313
+ </section>
314
+ <section id="test" class="level2" data-number="13.4">
315
+ <h2 data-number="13.4" class="anchored" data-anchor-id="test"><span class="header-section-number">13.4</span> Test</h2>
316
+ <div class="cell">
317
+ <div class="sourceCode cell-code" id="cb5"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(testthat)</span>
318
+ <span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a></span>
319
+ <span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a>testthat<span class="sc">::</span><span class="fu">test_that</span>(<span class="st">"Example tests"</span>, {</span>
320
+ <span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a> testthat<span class="sc">::</span><span class="fu">expect_equal</span>(<span class="fu">repeat_string</span>(<span class="dv">4</span>, <span class="st">'a'</span>), <span class="st">'aaaa'</span>)</span>
321
+ <span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a> testthat<span class="sc">::</span><span class="fu">expect_equal</span>(<span class="fu">repeat_string</span>(<span class="dv">3</span>, <span class="st">'hello '</span>), <span class="st">'hello hello hello '</span>)</span>
322
+ <span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a> testthat<span class="sc">::</span><span class="fu">expect_equal</span>(<span class="fu">repeat_string</span>(<span class="dv">2</span>, <span class="st">'abc'</span>), <span class="st">'abcabc'</span>)</span>
323
+ <span id="cb5-7"><a href="#cb5-7" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
324
+ <div class="cell-output cell-output-stdout">
325
+ <pre><code>Test passed πŸ₯³</code></pre>
326
+ </div>
327
+ </div>
328
+ </section>
329
+ <section id="supported-by" class="level2" data-number="13.5">
330
+ <h2 data-number="13.5" class="anchored" data-anchor-id="supported-by"><span class="header-section-number">13.5</span> Supported by</h2>
331
+ <div class="quarto-figure quarto-figure-center">
332
+ <figure class="figure">
333
+ <p><a href="https://www.starcore.co"><img src="new_starcore_logo.png" class="img-fluid figure-img"></a></p>
334
+ <figcaption class="figure-caption">StarCore Analytics</figcaption>
335
+ </figure>
336
+ </div>
337
 
338
 
339
+ </section>
340
 
341
  </main> <!-- /main -->
342
  <script id="quarto-html-after-body" type="application/javascript">
 
574
  </script>
575
  <nav class="page-navigation">
576
  <div class="nav-page nav-page-previous">
577
+ <a href="./cw012square_sum.html" class="pagination-link">
578
+ <i class="bi bi-arrow-left-short"></i> <span class="nav-page-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span>
579
  </a>
580
  </div>
581
  <div class="nav-page nav-page-next">
 
 
 
582
  </div>
583
  </nav>
584
  </div> <!-- /content -->
cw014summation.html ADDED
@@ -0,0 +1,609 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
3
+
4
+ <meta charset="utf-8">
5
+ <meta name="generator" content="quarto-1.3.433">
6
+
7
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
8
+
9
+
10
+ <title>Codewars Challenge 2024 Menggunakan R dan RStudio - 14&nbsp; Grasshopper - Summation</title>
11
+ <style>
12
+ code{white-space: pre-wrap;}
13
+ span.smallcaps{font-variant: small-caps;}
14
+ div.columns{display: flex; gap: min(4vw, 1.5em);}
15
+ div.column{flex: auto; overflow-x: auto;}
16
+ div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
17
+ ul.task-list{list-style: none;}
18
+ ul.task-list li input[type="checkbox"] {
19
+ width: 0.8em;
20
+ margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
21
+ vertical-align: middle;
22
+ }
23
+ /* CSS for syntax highlighting */
24
+ pre > code.sourceCode { white-space: pre; position: relative; }
25
+ pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
26
+ pre > code.sourceCode > span:empty { height: 1.2em; }
27
+ .sourceCode { overflow: visible; }
28
+ code.sourceCode > span { color: inherit; text-decoration: inherit; }
29
+ div.sourceCode { margin: 1em 0; }
30
+ pre.sourceCode { margin: 0; }
31
+ @media screen {
32
+ div.sourceCode { overflow: auto; }
33
+ }
34
+ @media print {
35
+ pre > code.sourceCode { white-space: pre-wrap; }
36
+ pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
37
+ }
38
+ pre.numberSource code
39
+ { counter-reset: source-line 0; }
40
+ pre.numberSource code > span
41
+ { position: relative; left: -4em; counter-increment: source-line; }
42
+ pre.numberSource code > span > a:first-child::before
43
+ { content: counter(source-line);
44
+ position: relative; left: -1em; text-align: right; vertical-align: baseline;
45
+ border: none; display: inline-block;
46
+ -webkit-touch-callout: none; -webkit-user-select: none;
47
+ -khtml-user-select: none; -moz-user-select: none;
48
+ -ms-user-select: none; user-select: none;
49
+ padding: 0 4px; width: 4em;
50
+ }
51
+ pre.numberSource { margin-left: 3em; padding-left: 4px; }
52
+ div.sourceCode
53
+ { }
54
+ @media screen {
55
+ pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
56
+ }
57
+ </style>
58
+
59
+
60
+ <script src="site_libs/quarto-nav/quarto-nav.js"></script>
61
+ <script src="site_libs/quarto-nav/headroom.min.js"></script>
62
+ <script src="site_libs/clipboard/clipboard.min.js"></script>
63
+ <script src="site_libs/quarto-search/autocomplete.umd.js"></script>
64
+ <script src="site_libs/quarto-search/fuse.min.js"></script>
65
+ <script src="site_libs/quarto-search/quarto-search.js"></script>
66
+ <meta name="quarto:offset" content="./">
67
+ <link href="./cw015no_spaces.html" rel="next">
68
+ <link href="./cw013repeat_string.html" rel="prev">
69
+ <link href="./logo.png" rel="icon" type="image/png">
70
+ <script src="site_libs/quarto-html/quarto.js"></script>
71
+ <script src="site_libs/quarto-html/popper.min.js"></script>
72
+ <script src="site_libs/quarto-html/tippy.umd.min.js"></script>
73
+ <script src="site_libs/quarto-html/anchor.min.js"></script>
74
+ <link href="site_libs/quarto-html/tippy.css" rel="stylesheet">
75
+ <link href="site_libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
76
+ <script src="site_libs/bootstrap/bootstrap.min.js"></script>
77
+ <link href="site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
78
+ <link href="site_libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
79
+ <link href="site_libs/quarto-contrib/badge/badge.css" rel="stylesheet">
80
+ <script id="quarto-search-options" type="application/json">{
81
+ "location": "sidebar",
82
+ "copy-button": false,
83
+ "collapse-after": 3,
84
+ "panel-placement": "start",
85
+ "type": "textbox",
86
+ "limit": 20,
87
+ "language": {
88
+ "search-no-results-text": "No results",
89
+ "search-matching-documents-text": "matching documents",
90
+ "search-copy-link-title": "Copy link to search",
91
+ "search-hide-matches-text": "Hide additional matches",
92
+ "search-more-match-text": "more match in this document",
93
+ "search-more-matches-text": "more matches in this document",
94
+ "search-clear-button-title": "Clear",
95
+ "search-detached-cancel-button-title": "Cancel",
96
+ "search-submit-button-title": "Submit",
97
+ "search-label": "Search"
98
+ }
99
+ }</script>
100
+
101
+
102
+ <meta name="twitter:title" content="Codewars Challenge 2024 Menggunakan R dan RStudio - 14&nbsp; Grasshopper - Summation">
103
+ <meta name="twitter:description" content="">
104
+ <meta name="twitter:image" content="https://huggingface.co/spaces/aephidayatuloh/codewars2024/new_starcore_logo.png">
105
+ <meta name="twitter:image-height" content="434">
106
+ <meta name="twitter:image-width" content="1946">
107
+ <meta name="twitter:card" content="summary_large_image">
108
+ </head>
109
+
110
+ <body class="nav-sidebar floating">
111
+
112
+ <div id="quarto-search-results"></div>
113
+ <header id="quarto-header" class="headroom fixed-top">
114
+ <nav class="quarto-secondary-nav">
115
+ <div class="container-fluid d-flex">
116
+ <button type="button" class="quarto-btn-toggle btn" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
117
+ <i class="bi bi-layout-text-sidebar-reverse"></i>
118
+ </button>
119
+ <nav class="quarto-page-breadcrumbs" aria-label="breadcrumb"><ol class="breadcrumb"><li class="breadcrumb-item"><a href="./cw001evenodd.html">Februari</a></li><li class="breadcrumb-item"><a href="./cw014summation.html"><span class="chapter-number">14</span>&nbsp; <span class="chapter-title">Grasshopper - Summation</span></a></li></ol></nav>
120
+ <a class="flex-grow-1" role="button" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
121
+ </a>
122
+ <button type="button" class="btn quarto-search-button" aria-label="" onclick="window.quartoOpenSearch();">
123
+ <i class="bi bi-search"></i>
124
+ </button>
125
+ </div>
126
+ </nav>
127
+ </header>
128
+ <!-- content -->
129
+ <div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article">
130
+ <!-- sidebar -->
131
+ <nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal sidebar-navigation floating overflow-auto">
132
+ <div class="pt-lg-2 mt-2 text-left sidebar-header">
133
+ <div class="sidebar-title mb-0 py-0">
134
+ <a href="./">Codewars Challenge 2024 Menggunakan R dan RStudio</a>
135
+ <div class="sidebar-tools-main">
136
+ <a href="https://huggingface.co/spaces/aephidayatuloh/codewars2024/tree/main" rel="" title="Source Code" class="quarto-navigation-tool px-1" aria-label="Source Code"><i class="bi bi-git"></i></a>
137
+ </div>
138
+ </div>
139
+ </div>
140
+ <div class="mt-2 flex-shrink-0 align-items-center">
141
+ <div class="sidebar-search">
142
+ <div id="quarto-search" class="" title="Search"></div>
143
+ </div>
144
+ </div>
145
+ <div class="sidebar-menu-container">
146
+ <ul class="list-unstyled mt-1">
147
+ <li class="sidebar-item">
148
+ <div class="sidebar-item-container">
149
+ <a href="./index.html" class="sidebar-item-text sidebar-link">
150
+ <span class="menu-text">Pengantar</span></a>
151
+ </div>
152
+ </li>
153
+ <li class="sidebar-item sidebar-item-section">
154
+ <div class="sidebar-item-container">
155
+ <a class="sidebar-item-text sidebar-link text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" aria-expanded="true">
156
+ <span class="menu-text">Februari</span></a>
157
+ <a class="sidebar-item-toggle text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" aria-expanded="true" aria-label="Toggle section">
158
+ <i class="bi bi-chevron-right ms-2"></i>
159
+ </a>
160
+ </div>
161
+ <ul id="quarto-sidebar-section-1" class="collapse list-unstyled sidebar-section depth1 show">
162
+ <li class="sidebar-item">
163
+ <div class="sidebar-item-container">
164
+ <a href="./cw001evenodd.html" class="sidebar-item-text sidebar-link">
165
+ <span class="menu-text"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Even or Odd</span></span></a>
166
+ </div>
167
+ </li>
168
+ <li class="sidebar-item">
169
+ <div class="sidebar-item-container">
170
+ <a href="./cw002multiply.html" class="sidebar-item-text sidebar-link">
171
+ <span class="menu-text"><span class="chapter-number">2</span>&nbsp; <span class="chapter-title">Multiply</span></span></a>
172
+ </div>
173
+ </li>
174
+ <li class="sidebar-item">
175
+ <div class="sidebar-item-container">
176
+ <a href="./cw003countsheep.html" class="sidebar-item-text sidebar-link">
177
+ <span class="menu-text"><span class="chapter-number">3</span>&nbsp; <span class="chapter-title">If you can’t sleep, just count sheep!!</span></span></a>
178
+ </div>
179
+ </li>
180
+ <li class="sidebar-item">
181
+ <div class="sidebar-item-container">
182
+ <a href="./cw004reducegrow.html" class="sidebar-item-text sidebar-link">
183
+ <span class="menu-text"><span class="chapter-number">4</span>&nbsp; <span class="chapter-title">Beginner - Reduce but Grow</span></span></a>
184
+ </div>
185
+ </li>
186
+ <li class="sidebar-item">
187
+ <div class="sidebar-item-container">
188
+ <a href="./cw005make_negative.html" class="sidebar-item-text sidebar-link">
189
+ <span class="menu-text"><span class="chapter-number">5</span>&nbsp; <span class="chapter-title">Return Negative</span></span></a>
190
+ </div>
191
+ </li>
192
+ <li class="sidebar-item">
193
+ <div class="sidebar-item-container">
194
+ <a href="./cw006positive_sum.html" class="sidebar-item-text sidebar-link">
195
+ <span class="menu-text"><span class="chapter-number">6</span>&nbsp; <span class="chapter-title">Sum of positive</span></span></a>
196
+ </div>
197
+ </li>
198
+ <li class="sidebar-item">
199
+ <div class="sidebar-item-container">
200
+ <a href="./cw007reversedstrings.html" class="sidebar-item-text sidebar-link">
201
+ <span class="menu-text"><span class="chapter-number">7</span>&nbsp; <span class="chapter-title">Reversed Strings</span></span></a>
202
+ </div>
203
+ </li>
204
+ <li class="sidebar-item">
205
+ <div class="sidebar-item-container">
206
+ <a href="./cw008bool_to_word.html" class="sidebar-item-text sidebar-link">
207
+ <span class="menu-text"><span class="chapter-number">8</span>&nbsp; <span class="chapter-title">Convert boolean values to strings β€˜Yes’ or β€˜No’</span></span></a>
208
+ </div>
209
+ </li>
210
+ <li class="sidebar-item">
211
+ <div class="sidebar-item-container">
212
+ <a href="./cw009number_to_string.html" class="sidebar-item-text sidebar-link">
213
+ <span class="menu-text"><span class="chapter-number">9</span>&nbsp; <span class="chapter-title">Convert a Number to a String!</span></span></a>
214
+ </div>
215
+ </li>
216
+ <li class="sidebar-item">
217
+ <div class="sidebar-item-container">
218
+ <a href="./cw010opposite.html" class="sidebar-item-text sidebar-link">
219
+ <span class="menu-text"><span class="chapter-number">10</span>&nbsp; <span class="chapter-title">Opposite number</span></span></a>
220
+ </div>
221
+ </li>
222
+ <li class="sidebar-item">
223
+ <div class="sidebar-item-container">
224
+ <a href="./cw011removeChar.html" class="sidebar-item-text sidebar-link">
225
+ <span class="menu-text"><span class="chapter-number">11</span>&nbsp; <span class="chapter-title">Remove First and Last Character</span></span></a>
226
+ </div>
227
+ </li>
228
+ <li class="sidebar-item">
229
+ <div class="sidebar-item-container">
230
+ <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
231
+ <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
232
+ </div>
233
+ </li>
234
+ <li class="sidebar-item">
235
+ <div class="sidebar-item-container">
236
+ <a href="./cw013repeat_string.html" class="sidebar-item-text sidebar-link">
237
+ <span class="menu-text"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">String repeat</span></span></a>
238
+ </div>
239
+ </li>
240
+ <li class="sidebar-item">
241
+ <div class="sidebar-item-container">
242
+ <a href="./cw014summation.html" class="sidebar-item-text sidebar-link active">
243
+ <span class="menu-text"><span class="chapter-number">14</span>&nbsp; <span class="chapter-title">Grasshopper - Summation</span></span></a>
244
+ </div>
245
+ </li>
246
+ <li class="sidebar-item">
247
+ <div class="sidebar-item-container">
248
+ <a href="./cw015no_spaces.html" class="sidebar-item-text sidebar-link">
249
+ <span class="menu-text"><span class="chapter-number">15</span>&nbsp; <span class="chapter-title">Remove String Spaces</span></span></a>
250
+ </div>
251
+ </li>
252
+ <li class="sidebar-item">
253
+ <div class="sidebar-item-container">
254
+ <a href="./cw016findSmallestInt.html" class="sidebar-item-text sidebar-link">
255
+ <span class="menu-text"><span class="chapter-number">16</span>&nbsp; <span class="chapter-title">Find the smallest integer in the array</span></span></a>
256
+ </div>
257
+ </li>
258
+ <li class="sidebar-item">
259
+ <div class="sidebar-item-container">
260
+ <a href="./cw017basic_op.html" class="sidebar-item-text sidebar-link">
261
+ <span class="menu-text"><span class="chapter-number">17</span>&nbsp; <span class="chapter-title">Basic Mathematical Operations</span></span></a>
262
+ </div>
263
+ </li>
264
+ </ul>
265
+ </li>
266
+ </ul>
267
+ </div>
268
+ </nav>
269
+ <div id="quarto-sidebar-glass" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass"></div>
270
+ <!-- margin-sidebar -->
271
+ <div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
272
+ <nav id="TOC" role="doc-toc" class="toc-active">
273
+ <h2 id="toc-title">Table of contents</h2>
274
+
275
+ <ul>
276
+ <li><a href="#instruction" id="toc-instruction" class="nav-link active" data-scroll-target="#instruction"><span class="header-section-number">14.1</span> Instruction</a></li>
277
+ <li><a href="#youtube-video" id="toc-youtube-video" class="nav-link" data-scroll-target="#youtube-video"><span class="header-section-number">14.2</span> YouTube Video</a></li>
278
+ <li><a href="#solution-code" id="toc-solution-code" class="nav-link" data-scroll-target="#solution-code"><span class="header-section-number">14.3</span> Solution Code</a></li>
279
+ <li><a href="#test" id="toc-test" class="nav-link" data-scroll-target="#test"><span class="header-section-number">14.4</span> Test</a></li>
280
+ <li><a href="#supported-by" id="toc-supported-by" class="nav-link" data-scroll-target="#supported-by"><span class="header-section-number">14.5</span> Supported by</a></li>
281
+ </ul>
282
+ </nav>
283
+ </div>
284
+ <!-- main -->
285
+ <main class="content" id="quarto-document-content">
286
+
287
+ <header id="title-block-header" class="quarto-title-block default">
288
+ <div class="quarto-title">
289
+ <h1 class="title"><span class="chapter-number">14</span>&nbsp; <span class="chapter-title">Grasshopper - Summation</span></h1>
290
+ </div>
291
+
292
+
293
+
294
+ <div class="quarto-title-meta">
295
+
296
+
297
+
298
+
299
+ </div>
300
+
301
+
302
+ </header>
303
+
304
+ <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Tantangan #14/366 - 28 Feb 2024</p>
305
+ <p><a href="https://www.codewars.com/kata/55d24f55d7dd296eb9000030" class="uri">https://www.codewars.com/kata/55d24f55d7dd296eb9000030</a></p>
306
+ <section id="instruction" class="level2" data-number="14.1">
307
+ <h2 data-number="14.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">14.1</span> Instruction</h2>
308
+ <p>Write a program that finds the summation of every number from 1 to num. The number will always be a positive integer greater than 0. Your function only needs to return the result, what is shown between parentheses in the example below is how you reach that result and it’s not part of it, see the sample tests.</p>
309
+ <p><strong>Examples (input -&gt; output)</strong></p>
310
+ <div class="cell">
311
+ <div class="sourceCode cell-code" id="cb1"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="dv">2</span> <span class="ot">-&gt;</span> <span class="dv">3</span> (<span class="dv">1</span> <span class="sc">+</span> <span class="dv">2</span>)</span>
312
+ <span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="dv">8</span> <span class="ot">-&gt;</span> <span class="dv">36</span> (<span class="dv">1</span> <span class="sc">+</span> <span class="dv">2</span> <span class="sc">+</span> <span class="dv">3</span> <span class="sc">+</span> <span class="dv">4</span> <span class="sc">+</span> <span class="dv">5</span> <span class="sc">+</span> <span class="dv">6</span> <span class="sc">+</span> <span class="dv">7</span> <span class="sc">+</span> <span class="dv">8</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
313
+ </div>
314
+ </section>
315
+ <section id="youtube-video" class="level2" data-number="14.2">
316
+ <h2 data-number="14.2" class="anchored" data-anchor-id="youtube-video"><span class="header-section-number">14.2</span> YouTube Video</h2>
317
+ <div class="quarto-video ratio ratio-16x9"><iframe data-external="1" src="https://www.youtube.com/embed/L8aczEhqymk?si=DSx84acpNvbkucrK" title="" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe></div>
318
+ </section>
319
+ <section id="solution-code" class="level2" data-number="14.3">
320
+ <h2 data-number="14.3" class="anchored" data-anchor-id="solution-code"><span class="header-section-number">14.3</span> Solution Code</h2>
321
+ <div class="cell">
322
+ <div class="sourceCode cell-code" id="cb2"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>summation <span class="ot">&lt;-</span> <span class="cf">function</span>(n) {</span>
323
+ <span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">sum</span>(<span class="dv">1</span><span class="sc">:</span>n)</span>
324
+ <span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a>}</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
325
+ </div>
326
+ <div class="cell">
327
+ <div class="sourceCode cell-code" id="cb3"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a>summation <span class="ot">&lt;-</span> <span class="cf">function</span>(n) <span class="fu">sum</span>(<span class="dv">1</span><span class="sc">:</span>n)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
328
+ </div>
329
+ </section>
330
+ <section id="test" class="level2" data-number="14.4">
331
+ <h2 data-number="14.4" class="anchored" data-anchor-id="test"><span class="header-section-number">14.4</span> Test</h2>
332
+ <div class="cell">
333
+ <div class="sourceCode cell-code" id="cb4"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(testthat)</span>
334
+ <span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a></span>
335
+ <span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="fu">test_that</span>(<span class="st">'basic tests'</span>, {</span>
336
+ <span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">summation</span>(<span class="dv">1</span>), <span class="dv">1</span>)</span>
337
+ <span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">summation</span>(<span class="dv">8</span>), <span class="dv">36</span>)</span>
338
+ <span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">summation</span>(<span class="dv">22</span>), <span class="dv">253</span>)</span>
339
+ <span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">summation</span>(<span class="dv">100</span>), <span class="dv">5050</span>)</span>
340
+ <span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">summation</span>(<span class="dv">213</span>), <span class="dv">22791</span>)</span>
341
+ <span id="cb4-9"><a href="#cb4-9" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
342
+ <div class="cell-output cell-output-stdout">
343
+ <pre><code>Test passed πŸ₯‡</code></pre>
344
+ </div>
345
+ </div>
346
+ </section>
347
+ <section id="supported-by" class="level2" data-number="14.5">
348
+ <h2 data-number="14.5" class="anchored" data-anchor-id="supported-by"><span class="header-section-number">14.5</span> Supported by</h2>
349
+ <div class="quarto-figure quarto-figure-center">
350
+ <figure class="figure">
351
+ <p><a href="https://www.starcore.co"><img src="new_starcore_logo.png" class="img-fluid figure-img"></a></p>
352
+ <figcaption class="figure-caption">StarCore Analytics</figcaption>
353
+ </figure>
354
+ </div>
355
+
356
+
357
+ </section>
358
+
359
+ </main> <!-- /main -->
360
+ <script id="quarto-html-after-body" type="application/javascript">
361
+ window.document.addEventListener("DOMContentLoaded", function (event) {
362
+ const toggleBodyColorMode = (bsSheetEl) => {
363
+ const mode = bsSheetEl.getAttribute("data-mode");
364
+ const bodyEl = window.document.querySelector("body");
365
+ if (mode === "dark") {
366
+ bodyEl.classList.add("quarto-dark");
367
+ bodyEl.classList.remove("quarto-light");
368
+ } else {
369
+ bodyEl.classList.add("quarto-light");
370
+ bodyEl.classList.remove("quarto-dark");
371
+ }
372
+ }
373
+ const toggleBodyColorPrimary = () => {
374
+ const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
375
+ if (bsSheetEl) {
376
+ toggleBodyColorMode(bsSheetEl);
377
+ }
378
+ }
379
+ toggleBodyColorPrimary();
380
+ const icon = "";
381
+ const anchorJS = new window.AnchorJS();
382
+ anchorJS.options = {
383
+ placement: 'right',
384
+ icon: icon
385
+ };
386
+ anchorJS.add('.anchored');
387
+ const isCodeAnnotation = (el) => {
388
+ for (const clz of el.classList) {
389
+ if (clz.startsWith('code-annotation-')) {
390
+ return true;
391
+ }
392
+ }
393
+ return false;
394
+ }
395
+ const clipboard = new window.ClipboardJS('.code-copy-button', {
396
+ text: function(trigger) {
397
+ const codeEl = trigger.previousElementSibling.cloneNode(true);
398
+ for (const childEl of codeEl.children) {
399
+ if (isCodeAnnotation(childEl)) {
400
+ childEl.remove();
401
+ }
402
+ }
403
+ return codeEl.innerText;
404
+ }
405
+ });
406
+ clipboard.on('success', function(e) {
407
+ // button target
408
+ const button = e.trigger;
409
+ // don't keep focus
410
+ button.blur();
411
+ // flash "checked"
412
+ button.classList.add('code-copy-button-checked');
413
+ var currentTitle = button.getAttribute("title");
414
+ button.setAttribute("title", "Copied!");
415
+ let tooltip;
416
+ if (window.bootstrap) {
417
+ button.setAttribute("data-bs-toggle", "tooltip");
418
+ button.setAttribute("data-bs-placement", "left");
419
+ button.setAttribute("data-bs-title", "Copied!");
420
+ tooltip = new bootstrap.Tooltip(button,
421
+ { trigger: "manual",
422
+ customClass: "code-copy-button-tooltip",
423
+ offset: [0, -8]});
424
+ tooltip.show();
425
+ }
426
+ setTimeout(function() {
427
+ if (tooltip) {
428
+ tooltip.hide();
429
+ button.removeAttribute("data-bs-title");
430
+ button.removeAttribute("data-bs-toggle");
431
+ button.removeAttribute("data-bs-placement");
432
+ }
433
+ button.setAttribute("title", currentTitle);
434
+ button.classList.remove('code-copy-button-checked');
435
+ }, 1000);
436
+ // clear code selection
437
+ e.clearSelection();
438
+ });
439
+ function tippyHover(el, contentFn) {
440
+ const config = {
441
+ allowHTML: true,
442
+ content: contentFn,
443
+ maxWidth: 500,
444
+ delay: 100,
445
+ arrow: false,
446
+ appendTo: function(el) {
447
+ return el.parentElement;
448
+ },
449
+ interactive: true,
450
+ interactiveBorder: 10,
451
+ theme: 'quarto',
452
+ placement: 'bottom-start'
453
+ };
454
+ window.tippy(el, config);
455
+ }
456
+ const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
457
+ for (var i=0; i<noterefs.length; i++) {
458
+ const ref = noterefs[i];
459
+ tippyHover(ref, function() {
460
+ // use id or data attribute instead here
461
+ let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
462
+ try { href = new URL(href).hash; } catch {}
463
+ const id = href.replace(/^#\/?/, "");
464
+ const note = window.document.getElementById(id);
465
+ return note.innerHTML;
466
+ });
467
+ }
468
+ let selectedAnnoteEl;
469
+ const selectorForAnnotation = ( cell, annotation) => {
470
+ let cellAttr = 'data-code-cell="' + cell + '"';
471
+ let lineAttr = 'data-code-annotation="' + annotation + '"';
472
+ const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
473
+ return selector;
474
+ }
475
+ const selectCodeLines = (annoteEl) => {
476
+ const doc = window.document;
477
+ const targetCell = annoteEl.getAttribute("data-target-cell");
478
+ const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
479
+ const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
480
+ const lines = annoteSpan.getAttribute("data-code-lines").split(",");
481
+ const lineIds = lines.map((line) => {
482
+ return targetCell + "-" + line;
483
+ })
484
+ let top = null;
485
+ let height = null;
486
+ let parent = null;
487
+ if (lineIds.length > 0) {
488
+ //compute the position of the single el (top and bottom and make a div)
489
+ const el = window.document.getElementById(lineIds[0]);
490
+ top = el.offsetTop;
491
+ height = el.offsetHeight;
492
+ parent = el.parentElement.parentElement;
493
+ if (lineIds.length > 1) {
494
+ const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
495
+ const bottom = lastEl.offsetTop + lastEl.offsetHeight;
496
+ height = bottom - top;
497
+ }
498
+ if (top !== null && height !== null && parent !== null) {
499
+ // cook up a div (if necessary) and position it
500
+ let div = window.document.getElementById("code-annotation-line-highlight");
501
+ if (div === null) {
502
+ div = window.document.createElement("div");
503
+ div.setAttribute("id", "code-annotation-line-highlight");
504
+ div.style.position = 'absolute';
505
+ parent.appendChild(div);
506
+ }
507
+ div.style.top = top - 2 + "px";
508
+ div.style.height = height + 4 + "px";
509
+ let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
510
+ if (gutterDiv === null) {
511
+ gutterDiv = window.document.createElement("div");
512
+ gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
513
+ gutterDiv.style.position = 'absolute';
514
+ const codeCell = window.document.getElementById(targetCell);
515
+ const gutter = codeCell.querySelector('.code-annotation-gutter');
516
+ gutter.appendChild(gutterDiv);
517
+ }
518
+ gutterDiv.style.top = top - 2 + "px";
519
+ gutterDiv.style.height = height + 4 + "px";
520
+ }
521
+ selectedAnnoteEl = annoteEl;
522
+ }
523
+ };
524
+ const unselectCodeLines = () => {
525
+ const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
526
+ elementsIds.forEach((elId) => {
527
+ const div = window.document.getElementById(elId);
528
+ if (div) {
529
+ div.remove();
530
+ }
531
+ });
532
+ selectedAnnoteEl = undefined;
533
+ };
534
+ // Attach click handler to the DT
535
+ const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
536
+ for (const annoteDlNode of annoteDls) {
537
+ annoteDlNode.addEventListener('click', (event) => {
538
+ const clickedEl = event.target;
539
+ if (clickedEl !== selectedAnnoteEl) {
540
+ unselectCodeLines();
541
+ const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
542
+ if (activeEl) {
543
+ activeEl.classList.remove('code-annotation-active');
544
+ }
545
+ selectCodeLines(clickedEl);
546
+ clickedEl.classList.add('code-annotation-active');
547
+ } else {
548
+ // Unselect the line
549
+ unselectCodeLines();
550
+ clickedEl.classList.remove('code-annotation-active');
551
+ }
552
+ });
553
+ }
554
+ const findCites = (el) => {
555
+ const parentEl = el.parentElement;
556
+ if (parentEl) {
557
+ const cites = parentEl.dataset.cites;
558
+ if (cites) {
559
+ return {
560
+ el,
561
+ cites: cites.split(' ')
562
+ };
563
+ } else {
564
+ return findCites(el.parentElement)
565
+ }
566
+ } else {
567
+ return undefined;
568
+ }
569
+ };
570
+ var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
571
+ for (var i=0; i<bibliorefs.length; i++) {
572
+ const ref = bibliorefs[i];
573
+ const citeInfo = findCites(ref);
574
+ if (citeInfo) {
575
+ tippyHover(citeInfo.el, function() {
576
+ var popup = window.document.createElement('div');
577
+ citeInfo.cites.forEach(function(cite) {
578
+ var citeDiv = window.document.createElement('div');
579
+ citeDiv.classList.add('hanging-indent');
580
+ citeDiv.classList.add('csl-entry');
581
+ var biblioDiv = window.document.getElementById('ref-' + cite);
582
+ if (biblioDiv) {
583
+ citeDiv.innerHTML = biblioDiv.innerHTML;
584
+ }
585
+ popup.appendChild(citeDiv);
586
+ });
587
+ return popup.innerHTML;
588
+ });
589
+ }
590
+ }
591
+ });
592
+ </script>
593
+ <nav class="page-navigation">
594
+ <div class="nav-page nav-page-previous">
595
+ <a href="./cw013repeat_string.html" class="pagination-link">
596
+ <i class="bi bi-arrow-left-short"></i> <span class="nav-page-text"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">String repeat</span></span>
597
+ </a>
598
+ </div>
599
+ <div class="nav-page nav-page-next">
600
+ <a href="./cw015no_spaces.html" class="pagination-link">
601
+ <span class="nav-page-text"><span class="chapter-number">15</span>&nbsp; <span class="chapter-title">Remove String Spaces</span></span> <i class="bi bi-arrow-right-short"></i>
602
+ </a>
603
+ </div>
604
+ </nav>
605
+ </div> <!-- /content -->
606
+
607
+
608
+
609
+ </body></html>
cw015no_spaces.html ADDED
@@ -0,0 +1,608 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
3
+
4
+ <meta charset="utf-8">
5
+ <meta name="generator" content="quarto-1.3.433">
6
+
7
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
8
+
9
+
10
+ <title>Codewars Challenge 2024 Menggunakan R dan RStudio - 15&nbsp; Remove String Spaces</title>
11
+ <style>
12
+ code{white-space: pre-wrap;}
13
+ span.smallcaps{font-variant: small-caps;}
14
+ div.columns{display: flex; gap: min(4vw, 1.5em);}
15
+ div.column{flex: auto; overflow-x: auto;}
16
+ div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
17
+ ul.task-list{list-style: none;}
18
+ ul.task-list li input[type="checkbox"] {
19
+ width: 0.8em;
20
+ margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
21
+ vertical-align: middle;
22
+ }
23
+ /* CSS for syntax highlighting */
24
+ pre > code.sourceCode { white-space: pre; position: relative; }
25
+ pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
26
+ pre > code.sourceCode > span:empty { height: 1.2em; }
27
+ .sourceCode { overflow: visible; }
28
+ code.sourceCode > span { color: inherit; text-decoration: inherit; }
29
+ div.sourceCode { margin: 1em 0; }
30
+ pre.sourceCode { margin: 0; }
31
+ @media screen {
32
+ div.sourceCode { overflow: auto; }
33
+ }
34
+ @media print {
35
+ pre > code.sourceCode { white-space: pre-wrap; }
36
+ pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
37
+ }
38
+ pre.numberSource code
39
+ { counter-reset: source-line 0; }
40
+ pre.numberSource code > span
41
+ { position: relative; left: -4em; counter-increment: source-line; }
42
+ pre.numberSource code > span > a:first-child::before
43
+ { content: counter(source-line);
44
+ position: relative; left: -1em; text-align: right; vertical-align: baseline;
45
+ border: none; display: inline-block;
46
+ -webkit-touch-callout: none; -webkit-user-select: none;
47
+ -khtml-user-select: none; -moz-user-select: none;
48
+ -ms-user-select: none; user-select: none;
49
+ padding: 0 4px; width: 4em;
50
+ }
51
+ pre.numberSource { margin-left: 3em; padding-left: 4px; }
52
+ div.sourceCode
53
+ { }
54
+ @media screen {
55
+ pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
56
+ }
57
+ </style>
58
+
59
+
60
+ <script src="site_libs/quarto-nav/quarto-nav.js"></script>
61
+ <script src="site_libs/quarto-nav/headroom.min.js"></script>
62
+ <script src="site_libs/clipboard/clipboard.min.js"></script>
63
+ <script src="site_libs/quarto-search/autocomplete.umd.js"></script>
64
+ <script src="site_libs/quarto-search/fuse.min.js"></script>
65
+ <script src="site_libs/quarto-search/quarto-search.js"></script>
66
+ <meta name="quarto:offset" content="./">
67
+ <link href="./cw016findSmallestInt.html" rel="next">
68
+ <link href="./cw014summation.html" rel="prev">
69
+ <link href="./logo.png" rel="icon" type="image/png">
70
+ <script src="site_libs/quarto-html/quarto.js"></script>
71
+ <script src="site_libs/quarto-html/popper.min.js"></script>
72
+ <script src="site_libs/quarto-html/tippy.umd.min.js"></script>
73
+ <script src="site_libs/quarto-html/anchor.min.js"></script>
74
+ <link href="site_libs/quarto-html/tippy.css" rel="stylesheet">
75
+ <link href="site_libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
76
+ <script src="site_libs/bootstrap/bootstrap.min.js"></script>
77
+ <link href="site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
78
+ <link href="site_libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
79
+ <link href="site_libs/quarto-contrib/badge/badge.css" rel="stylesheet">
80
+ <script id="quarto-search-options" type="application/json">{
81
+ "location": "sidebar",
82
+ "copy-button": false,
83
+ "collapse-after": 3,
84
+ "panel-placement": "start",
85
+ "type": "textbox",
86
+ "limit": 20,
87
+ "language": {
88
+ "search-no-results-text": "No results",
89
+ "search-matching-documents-text": "matching documents",
90
+ "search-copy-link-title": "Copy link to search",
91
+ "search-hide-matches-text": "Hide additional matches",
92
+ "search-more-match-text": "more match in this document",
93
+ "search-more-matches-text": "more matches in this document",
94
+ "search-clear-button-title": "Clear",
95
+ "search-detached-cancel-button-title": "Cancel",
96
+ "search-submit-button-title": "Submit",
97
+ "search-label": "Search"
98
+ }
99
+ }</script>
100
+
101
+
102
+ <meta name="twitter:title" content="Codewars Challenge 2024 Menggunakan R dan RStudio - 15&nbsp; Remove String Spaces">
103
+ <meta name="twitter:description" content="">
104
+ <meta name="twitter:image" content="https://huggingface.co/spaces/aephidayatuloh/codewars2024/new_starcore_logo.png">
105
+ <meta name="twitter:image-height" content="434">
106
+ <meta name="twitter:image-width" content="1946">
107
+ <meta name="twitter:card" content="summary_large_image">
108
+ </head>
109
+
110
+ <body class="nav-sidebar floating">
111
+
112
+ <div id="quarto-search-results"></div>
113
+ <header id="quarto-header" class="headroom fixed-top">
114
+ <nav class="quarto-secondary-nav">
115
+ <div class="container-fluid d-flex">
116
+ <button type="button" class="quarto-btn-toggle btn" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
117
+ <i class="bi bi-layout-text-sidebar-reverse"></i>
118
+ </button>
119
+ <nav class="quarto-page-breadcrumbs" aria-label="breadcrumb"><ol class="breadcrumb"><li class="breadcrumb-item"><a href="./cw001evenodd.html">Februari</a></li><li class="breadcrumb-item"><a href="./cw015no_spaces.html"><span class="chapter-number">15</span>&nbsp; <span class="chapter-title">Remove String Spaces</span></a></li></ol></nav>
120
+ <a class="flex-grow-1" role="button" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
121
+ </a>
122
+ <button type="button" class="btn quarto-search-button" aria-label="" onclick="window.quartoOpenSearch();">
123
+ <i class="bi bi-search"></i>
124
+ </button>
125
+ </div>
126
+ </nav>
127
+ </header>
128
+ <!-- content -->
129
+ <div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article">
130
+ <!-- sidebar -->
131
+ <nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal sidebar-navigation floating overflow-auto">
132
+ <div class="pt-lg-2 mt-2 text-left sidebar-header">
133
+ <div class="sidebar-title mb-0 py-0">
134
+ <a href="./">Codewars Challenge 2024 Menggunakan R dan RStudio</a>
135
+ <div class="sidebar-tools-main">
136
+ <a href="https://huggingface.co/spaces/aephidayatuloh/codewars2024/tree/main" rel="" title="Source Code" class="quarto-navigation-tool px-1" aria-label="Source Code"><i class="bi bi-git"></i></a>
137
+ </div>
138
+ </div>
139
+ </div>
140
+ <div class="mt-2 flex-shrink-0 align-items-center">
141
+ <div class="sidebar-search">
142
+ <div id="quarto-search" class="" title="Search"></div>
143
+ </div>
144
+ </div>
145
+ <div class="sidebar-menu-container">
146
+ <ul class="list-unstyled mt-1">
147
+ <li class="sidebar-item">
148
+ <div class="sidebar-item-container">
149
+ <a href="./index.html" class="sidebar-item-text sidebar-link">
150
+ <span class="menu-text">Pengantar</span></a>
151
+ </div>
152
+ </li>
153
+ <li class="sidebar-item sidebar-item-section">
154
+ <div class="sidebar-item-container">
155
+ <a class="sidebar-item-text sidebar-link text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" aria-expanded="true">
156
+ <span class="menu-text">Februari</span></a>
157
+ <a class="sidebar-item-toggle text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" aria-expanded="true" aria-label="Toggle section">
158
+ <i class="bi bi-chevron-right ms-2"></i>
159
+ </a>
160
+ </div>
161
+ <ul id="quarto-sidebar-section-1" class="collapse list-unstyled sidebar-section depth1 show">
162
+ <li class="sidebar-item">
163
+ <div class="sidebar-item-container">
164
+ <a href="./cw001evenodd.html" class="sidebar-item-text sidebar-link">
165
+ <span class="menu-text"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Even or Odd</span></span></a>
166
+ </div>
167
+ </li>
168
+ <li class="sidebar-item">
169
+ <div class="sidebar-item-container">
170
+ <a href="./cw002multiply.html" class="sidebar-item-text sidebar-link">
171
+ <span class="menu-text"><span class="chapter-number">2</span>&nbsp; <span class="chapter-title">Multiply</span></span></a>
172
+ </div>
173
+ </li>
174
+ <li class="sidebar-item">
175
+ <div class="sidebar-item-container">
176
+ <a href="./cw003countsheep.html" class="sidebar-item-text sidebar-link">
177
+ <span class="menu-text"><span class="chapter-number">3</span>&nbsp; <span class="chapter-title">If you can’t sleep, just count sheep!!</span></span></a>
178
+ </div>
179
+ </li>
180
+ <li class="sidebar-item">
181
+ <div class="sidebar-item-container">
182
+ <a href="./cw004reducegrow.html" class="sidebar-item-text sidebar-link">
183
+ <span class="menu-text"><span class="chapter-number">4</span>&nbsp; <span class="chapter-title">Beginner - Reduce but Grow</span></span></a>
184
+ </div>
185
+ </li>
186
+ <li class="sidebar-item">
187
+ <div class="sidebar-item-container">
188
+ <a href="./cw005make_negative.html" class="sidebar-item-text sidebar-link">
189
+ <span class="menu-text"><span class="chapter-number">5</span>&nbsp; <span class="chapter-title">Return Negative</span></span></a>
190
+ </div>
191
+ </li>
192
+ <li class="sidebar-item">
193
+ <div class="sidebar-item-container">
194
+ <a href="./cw006positive_sum.html" class="sidebar-item-text sidebar-link">
195
+ <span class="menu-text"><span class="chapter-number">6</span>&nbsp; <span class="chapter-title">Sum of positive</span></span></a>
196
+ </div>
197
+ </li>
198
+ <li class="sidebar-item">
199
+ <div class="sidebar-item-container">
200
+ <a href="./cw007reversedstrings.html" class="sidebar-item-text sidebar-link">
201
+ <span class="menu-text"><span class="chapter-number">7</span>&nbsp; <span class="chapter-title">Reversed Strings</span></span></a>
202
+ </div>
203
+ </li>
204
+ <li class="sidebar-item">
205
+ <div class="sidebar-item-container">
206
+ <a href="./cw008bool_to_word.html" class="sidebar-item-text sidebar-link">
207
+ <span class="menu-text"><span class="chapter-number">8</span>&nbsp; <span class="chapter-title">Convert boolean values to strings β€˜Yes’ or β€˜No’</span></span></a>
208
+ </div>
209
+ </li>
210
+ <li class="sidebar-item">
211
+ <div class="sidebar-item-container">
212
+ <a href="./cw009number_to_string.html" class="sidebar-item-text sidebar-link">
213
+ <span class="menu-text"><span class="chapter-number">9</span>&nbsp; <span class="chapter-title">Convert a Number to a String!</span></span></a>
214
+ </div>
215
+ </li>
216
+ <li class="sidebar-item">
217
+ <div class="sidebar-item-container">
218
+ <a href="./cw010opposite.html" class="sidebar-item-text sidebar-link">
219
+ <span class="menu-text"><span class="chapter-number">10</span>&nbsp; <span class="chapter-title">Opposite number</span></span></a>
220
+ </div>
221
+ </li>
222
+ <li class="sidebar-item">
223
+ <div class="sidebar-item-container">
224
+ <a href="./cw011removeChar.html" class="sidebar-item-text sidebar-link">
225
+ <span class="menu-text"><span class="chapter-number">11</span>&nbsp; <span class="chapter-title">Remove First and Last Character</span></span></a>
226
+ </div>
227
+ </li>
228
+ <li class="sidebar-item">
229
+ <div class="sidebar-item-container">
230
+ <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
231
+ <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
232
+ </div>
233
+ </li>
234
+ <li class="sidebar-item">
235
+ <div class="sidebar-item-container">
236
+ <a href="./cw013repeat_string.html" class="sidebar-item-text sidebar-link">
237
+ <span class="menu-text"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">String repeat</span></span></a>
238
+ </div>
239
+ </li>
240
+ <li class="sidebar-item">
241
+ <div class="sidebar-item-container">
242
+ <a href="./cw014summation.html" class="sidebar-item-text sidebar-link">
243
+ <span class="menu-text"><span class="chapter-number">14</span>&nbsp; <span class="chapter-title">Grasshopper - Summation</span></span></a>
244
+ </div>
245
+ </li>
246
+ <li class="sidebar-item">
247
+ <div class="sidebar-item-container">
248
+ <a href="./cw015no_spaces.html" class="sidebar-item-text sidebar-link active">
249
+ <span class="menu-text"><span class="chapter-number">15</span>&nbsp; <span class="chapter-title">Remove String Spaces</span></span></a>
250
+ </div>
251
+ </li>
252
+ <li class="sidebar-item">
253
+ <div class="sidebar-item-container">
254
+ <a href="./cw016findSmallestInt.html" class="sidebar-item-text sidebar-link">
255
+ <span class="menu-text"><span class="chapter-number">16</span>&nbsp; <span class="chapter-title">Find the smallest integer in the array</span></span></a>
256
+ </div>
257
+ </li>
258
+ <li class="sidebar-item">
259
+ <div class="sidebar-item-container">
260
+ <a href="./cw017basic_op.html" class="sidebar-item-text sidebar-link">
261
+ <span class="menu-text"><span class="chapter-number">17</span>&nbsp; <span class="chapter-title">Basic Mathematical Operations</span></span></a>
262
+ </div>
263
+ </li>
264
+ </ul>
265
+ </li>
266
+ </ul>
267
+ </div>
268
+ </nav>
269
+ <div id="quarto-sidebar-glass" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass"></div>
270
+ <!-- margin-sidebar -->
271
+ <div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
272
+ <nav id="TOC" role="doc-toc" class="toc-active">
273
+ <h2 id="toc-title">Table of contents</h2>
274
+
275
+ <ul>
276
+ <li><a href="#instruction" id="toc-instruction" class="nav-link active" data-scroll-target="#instruction"><span class="header-section-number">15.1</span> Instruction</a></li>
277
+ <li><a href="#youtube-video" id="toc-youtube-video" class="nav-link" data-scroll-target="#youtube-video"><span class="header-section-number">15.2</span> YouTube Video</a></li>
278
+ <li><a href="#solution-code" id="toc-solution-code" class="nav-link" data-scroll-target="#solution-code"><span class="header-section-number">15.3</span> Solution Code</a></li>
279
+ <li><a href="#test" id="toc-test" class="nav-link" data-scroll-target="#test"><span class="header-section-number">15.4</span> Test</a></li>
280
+ <li><a href="#supported-by" id="toc-supported-by" class="nav-link" data-scroll-target="#supported-by"><span class="header-section-number">15.5</span> Supported by</a></li>
281
+ </ul>
282
+ </nav>
283
+ </div>
284
+ <!-- main -->
285
+ <main class="content" id="quarto-document-content">
286
+
287
+ <header id="title-block-header" class="quarto-title-block default">
288
+ <div class="quarto-title">
289
+ <h1 class="title"><span class="chapter-number">15</span>&nbsp; <span class="chapter-title">Remove String Spaces</span></h1>
290
+ </div>
291
+
292
+
293
+
294
+ <div class="quarto-title-meta">
295
+
296
+
297
+
298
+
299
+ </div>
300
+
301
+
302
+ </header>
303
+
304
+ <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Tantangan #15/366 - 29 Feb 2024</p>
305
+ <p><a href="https://www.codewars.com/kata/57eae20f5500ad98e50002c5" class="uri">https://www.codewars.com/kata/57eae20f5500ad98e50002c5</a></p>
306
+ <section id="instruction" class="level2" data-number="15.1">
307
+ <h2 data-number="15.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">15.1</span> Instruction</h2>
308
+ <p>Write a function that removes the spaces from the string, then return the resultant string.</p>
309
+ <p><strong>Examples:</strong></p>
310
+ <div class="cell">
311
+ <div class="sourceCode cell-code" id="cb1"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a>Input <span class="ot">-&gt;</span> Output</span>
312
+ <span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="st">"8 j 8 mBliB8g imjB8B8 jl B"</span> <span class="ot">-&gt;</span> <span class="st">"8j8mBliB8gimjB8B8jlB"</span></span>
313
+ <span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="st">"8 8 Bi fk8h B 8 BB8B B B B888 c hl8 BhB fd"</span> <span class="ot">-&gt;</span> <span class="st">"88Bifk8hB8BB8BBBB888chl8BhBfd"</span></span>
314
+ <span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a><span class="st">"8aaaaa dddd r "</span> <span class="ot">-&gt;</span> <span class="st">"8aaaaaddddr"</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
315
+ </div>
316
+ </section>
317
+ <section id="youtube-video" class="level2" data-number="15.2">
318
+ <h2 data-number="15.2" class="anchored" data-anchor-id="youtube-video"><span class="header-section-number">15.2</span> YouTube Video</h2>
319
+ <div class="quarto-video ratio ratio-16x9"><iframe data-external="1" src="https://www.youtube.com/embed/L8aczEhqymk?si=DSx84acpNvbkucrK" title="" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe></div>
320
+ </section>
321
+ <section id="solution-code" class="level2" data-number="15.3">
322
+ <h2 data-number="15.3" class="anchored" data-anchor-id="solution-code"><span class="header-section-number">15.3</span> Solution Code</h2>
323
+ <div class="cell">
324
+ <div class="sourceCode cell-code" id="cb2"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>no_space <span class="ot">&lt;-</span> <span class="cf">function</span>(x){</span>
325
+ <span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">gsub</span>(<span class="st">" "</span>, <span class="st">""</span>, x)</span>
326
+ <span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a>}</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
327
+ </div>
328
+ </section>
329
+ <section id="test" class="level2" data-number="15.4">
330
+ <h2 data-number="15.4" class="anchored" data-anchor-id="test"><span class="header-section-number">15.4</span> Test</h2>
331
+ <div class="cell">
332
+ <div class="sourceCode cell-code" id="cb3"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(testthat)</span>
333
+ <span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a></span>
334
+ <span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a><span class="fu">test_that</span>(<span class="st">'Basic tests'</span>, {</span>
335
+ <span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">no_space</span>(<span class="st">'8 j 8 mBliB8g imjB8B8 jl B'</span>), <span class="st">'8j8mBliB8gimjB8B8jlB'</span>)</span>
336
+ <span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">no_space</span>(<span class="st">'8 8 Bi fk8h B 8 BB8B B B B888 c hl8 BhB fd'</span>), <span class="st">'88Bifk8hB8BB8BBBB888chl8BhBfd'</span>)</span>
337
+ <span id="cb3-6"><a href="#cb3-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">no_space</span>(<span class="st">'8aaaaa dddd r '</span>), <span class="st">'8aaaaaddddr'</span>)</span>
338
+ <span id="cb3-7"><a href="#cb3-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">no_space</span>(<span class="st">'jfBm gk lf8hg 88lbe8 '</span>), <span class="st">'jfBmgklf8hg88lbe8'</span>) </span>
339
+ <span id="cb3-8"><a href="#cb3-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">no_space</span>(<span class="st">'8j aam'</span>), <span class="st">'8jaam'</span>)</span>
340
+ <span id="cb3-9"><a href="#cb3-9" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
341
+ <div class="cell-output cell-output-stdout">
342
+ <pre><code>Test passed πŸ₯‡</code></pre>
343
+ </div>
344
+ </div>
345
+ </section>
346
+ <section id="supported-by" class="level2" data-number="15.5">
347
+ <h2 data-number="15.5" class="anchored" data-anchor-id="supported-by"><span class="header-section-number">15.5</span> Supported by</h2>
348
+ <div class="quarto-figure quarto-figure-center">
349
+ <figure class="figure">
350
+ <p><a href="https://www.starcore.co"><img src="new_starcore_logo.png" class="img-fluid figure-img"></a></p>
351
+ <figcaption class="figure-caption">StarCore Analytics</figcaption>
352
+ </figure>
353
+ </div>
354
+
355
+
356
+ </section>
357
+
358
+ </main> <!-- /main -->
359
+ <script id="quarto-html-after-body" type="application/javascript">
360
+ window.document.addEventListener("DOMContentLoaded", function (event) {
361
+ const toggleBodyColorMode = (bsSheetEl) => {
362
+ const mode = bsSheetEl.getAttribute("data-mode");
363
+ const bodyEl = window.document.querySelector("body");
364
+ if (mode === "dark") {
365
+ bodyEl.classList.add("quarto-dark");
366
+ bodyEl.classList.remove("quarto-light");
367
+ } else {
368
+ bodyEl.classList.add("quarto-light");
369
+ bodyEl.classList.remove("quarto-dark");
370
+ }
371
+ }
372
+ const toggleBodyColorPrimary = () => {
373
+ const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
374
+ if (bsSheetEl) {
375
+ toggleBodyColorMode(bsSheetEl);
376
+ }
377
+ }
378
+ toggleBodyColorPrimary();
379
+ const icon = "";
380
+ const anchorJS = new window.AnchorJS();
381
+ anchorJS.options = {
382
+ placement: 'right',
383
+ icon: icon
384
+ };
385
+ anchorJS.add('.anchored');
386
+ const isCodeAnnotation = (el) => {
387
+ for (const clz of el.classList) {
388
+ if (clz.startsWith('code-annotation-')) {
389
+ return true;
390
+ }
391
+ }
392
+ return false;
393
+ }
394
+ const clipboard = new window.ClipboardJS('.code-copy-button', {
395
+ text: function(trigger) {
396
+ const codeEl = trigger.previousElementSibling.cloneNode(true);
397
+ for (const childEl of codeEl.children) {
398
+ if (isCodeAnnotation(childEl)) {
399
+ childEl.remove();
400
+ }
401
+ }
402
+ return codeEl.innerText;
403
+ }
404
+ });
405
+ clipboard.on('success', function(e) {
406
+ // button target
407
+ const button = e.trigger;
408
+ // don't keep focus
409
+ button.blur();
410
+ // flash "checked"
411
+ button.classList.add('code-copy-button-checked');
412
+ var currentTitle = button.getAttribute("title");
413
+ button.setAttribute("title", "Copied!");
414
+ let tooltip;
415
+ if (window.bootstrap) {
416
+ button.setAttribute("data-bs-toggle", "tooltip");
417
+ button.setAttribute("data-bs-placement", "left");
418
+ button.setAttribute("data-bs-title", "Copied!");
419
+ tooltip = new bootstrap.Tooltip(button,
420
+ { trigger: "manual",
421
+ customClass: "code-copy-button-tooltip",
422
+ offset: [0, -8]});
423
+ tooltip.show();
424
+ }
425
+ setTimeout(function() {
426
+ if (tooltip) {
427
+ tooltip.hide();
428
+ button.removeAttribute("data-bs-title");
429
+ button.removeAttribute("data-bs-toggle");
430
+ button.removeAttribute("data-bs-placement");
431
+ }
432
+ button.setAttribute("title", currentTitle);
433
+ button.classList.remove('code-copy-button-checked');
434
+ }, 1000);
435
+ // clear code selection
436
+ e.clearSelection();
437
+ });
438
+ function tippyHover(el, contentFn) {
439
+ const config = {
440
+ allowHTML: true,
441
+ content: contentFn,
442
+ maxWidth: 500,
443
+ delay: 100,
444
+ arrow: false,
445
+ appendTo: function(el) {
446
+ return el.parentElement;
447
+ },
448
+ interactive: true,
449
+ interactiveBorder: 10,
450
+ theme: 'quarto',
451
+ placement: 'bottom-start'
452
+ };
453
+ window.tippy(el, config);
454
+ }
455
+ const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
456
+ for (var i=0; i<noterefs.length; i++) {
457
+ const ref = noterefs[i];
458
+ tippyHover(ref, function() {
459
+ // use id or data attribute instead here
460
+ let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
461
+ try { href = new URL(href).hash; } catch {}
462
+ const id = href.replace(/^#\/?/, "");
463
+ const note = window.document.getElementById(id);
464
+ return note.innerHTML;
465
+ });
466
+ }
467
+ let selectedAnnoteEl;
468
+ const selectorForAnnotation = ( cell, annotation) => {
469
+ let cellAttr = 'data-code-cell="' + cell + '"';
470
+ let lineAttr = 'data-code-annotation="' + annotation + '"';
471
+ const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
472
+ return selector;
473
+ }
474
+ const selectCodeLines = (annoteEl) => {
475
+ const doc = window.document;
476
+ const targetCell = annoteEl.getAttribute("data-target-cell");
477
+ const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
478
+ const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
479
+ const lines = annoteSpan.getAttribute("data-code-lines").split(",");
480
+ const lineIds = lines.map((line) => {
481
+ return targetCell + "-" + line;
482
+ })
483
+ let top = null;
484
+ let height = null;
485
+ let parent = null;
486
+ if (lineIds.length > 0) {
487
+ //compute the position of the single el (top and bottom and make a div)
488
+ const el = window.document.getElementById(lineIds[0]);
489
+ top = el.offsetTop;
490
+ height = el.offsetHeight;
491
+ parent = el.parentElement.parentElement;
492
+ if (lineIds.length > 1) {
493
+ const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
494
+ const bottom = lastEl.offsetTop + lastEl.offsetHeight;
495
+ height = bottom - top;
496
+ }
497
+ if (top !== null && height !== null && parent !== null) {
498
+ // cook up a div (if necessary) and position it
499
+ let div = window.document.getElementById("code-annotation-line-highlight");
500
+ if (div === null) {
501
+ div = window.document.createElement("div");
502
+ div.setAttribute("id", "code-annotation-line-highlight");
503
+ div.style.position = 'absolute';
504
+ parent.appendChild(div);
505
+ }
506
+ div.style.top = top - 2 + "px";
507
+ div.style.height = height + 4 + "px";
508
+ let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
509
+ if (gutterDiv === null) {
510
+ gutterDiv = window.document.createElement("div");
511
+ gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
512
+ gutterDiv.style.position = 'absolute';
513
+ const codeCell = window.document.getElementById(targetCell);
514
+ const gutter = codeCell.querySelector('.code-annotation-gutter');
515
+ gutter.appendChild(gutterDiv);
516
+ }
517
+ gutterDiv.style.top = top - 2 + "px";
518
+ gutterDiv.style.height = height + 4 + "px";
519
+ }
520
+ selectedAnnoteEl = annoteEl;
521
+ }
522
+ };
523
+ const unselectCodeLines = () => {
524
+ const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
525
+ elementsIds.forEach((elId) => {
526
+ const div = window.document.getElementById(elId);
527
+ if (div) {
528
+ div.remove();
529
+ }
530
+ });
531
+ selectedAnnoteEl = undefined;
532
+ };
533
+ // Attach click handler to the DT
534
+ const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
535
+ for (const annoteDlNode of annoteDls) {
536
+ annoteDlNode.addEventListener('click', (event) => {
537
+ const clickedEl = event.target;
538
+ if (clickedEl !== selectedAnnoteEl) {
539
+ unselectCodeLines();
540
+ const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
541
+ if (activeEl) {
542
+ activeEl.classList.remove('code-annotation-active');
543
+ }
544
+ selectCodeLines(clickedEl);
545
+ clickedEl.classList.add('code-annotation-active');
546
+ } else {
547
+ // Unselect the line
548
+ unselectCodeLines();
549
+ clickedEl.classList.remove('code-annotation-active');
550
+ }
551
+ });
552
+ }
553
+ const findCites = (el) => {
554
+ const parentEl = el.parentElement;
555
+ if (parentEl) {
556
+ const cites = parentEl.dataset.cites;
557
+ if (cites) {
558
+ return {
559
+ el,
560
+ cites: cites.split(' ')
561
+ };
562
+ } else {
563
+ return findCites(el.parentElement)
564
+ }
565
+ } else {
566
+ return undefined;
567
+ }
568
+ };
569
+ var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
570
+ for (var i=0; i<bibliorefs.length; i++) {
571
+ const ref = bibliorefs[i];
572
+ const citeInfo = findCites(ref);
573
+ if (citeInfo) {
574
+ tippyHover(citeInfo.el, function() {
575
+ var popup = window.document.createElement('div');
576
+ citeInfo.cites.forEach(function(cite) {
577
+ var citeDiv = window.document.createElement('div');
578
+ citeDiv.classList.add('hanging-indent');
579
+ citeDiv.classList.add('csl-entry');
580
+ var biblioDiv = window.document.getElementById('ref-' + cite);
581
+ if (biblioDiv) {
582
+ citeDiv.innerHTML = biblioDiv.innerHTML;
583
+ }
584
+ popup.appendChild(citeDiv);
585
+ });
586
+ return popup.innerHTML;
587
+ });
588
+ }
589
+ }
590
+ });
591
+ </script>
592
+ <nav class="page-navigation">
593
+ <div class="nav-page nav-page-previous">
594
+ <a href="./cw014summation.html" class="pagination-link">
595
+ <i class="bi bi-arrow-left-short"></i> <span class="nav-page-text"><span class="chapter-number">14</span>&nbsp; <span class="chapter-title">Grasshopper - Summation</span></span>
596
+ </a>
597
+ </div>
598
+ <div class="nav-page nav-page-next">
599
+ <a href="./cw016findSmallestInt.html" class="pagination-link">
600
+ <span class="nav-page-text"><span class="chapter-number">16</span>&nbsp; <span class="chapter-title">Find the smallest integer in the array</span></span> <i class="bi bi-arrow-right-short"></i>
601
+ </a>
602
+ </div>
603
+ </nav>
604
+ </div> <!-- /content -->
605
+
606
+
607
+
608
+ </body></html>
cw016findSmallestInt.html ADDED
@@ -0,0 +1,606 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
3
+
4
+ <meta charset="utf-8">
5
+ <meta name="generator" content="quarto-1.3.433">
6
+
7
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
8
+
9
+
10
+ <title>Codewars Challenge 2024 Menggunakan R dan RStudio - 16&nbsp; Find the smallest integer in the array</title>
11
+ <style>
12
+ code{white-space: pre-wrap;}
13
+ span.smallcaps{font-variant: small-caps;}
14
+ div.columns{display: flex; gap: min(4vw, 1.5em);}
15
+ div.column{flex: auto; overflow-x: auto;}
16
+ div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
17
+ ul.task-list{list-style: none;}
18
+ ul.task-list li input[type="checkbox"] {
19
+ width: 0.8em;
20
+ margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
21
+ vertical-align: middle;
22
+ }
23
+ /* CSS for syntax highlighting */
24
+ pre > code.sourceCode { white-space: pre; position: relative; }
25
+ pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
26
+ pre > code.sourceCode > span:empty { height: 1.2em; }
27
+ .sourceCode { overflow: visible; }
28
+ code.sourceCode > span { color: inherit; text-decoration: inherit; }
29
+ div.sourceCode { margin: 1em 0; }
30
+ pre.sourceCode { margin: 0; }
31
+ @media screen {
32
+ div.sourceCode { overflow: auto; }
33
+ }
34
+ @media print {
35
+ pre > code.sourceCode { white-space: pre-wrap; }
36
+ pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
37
+ }
38
+ pre.numberSource code
39
+ { counter-reset: source-line 0; }
40
+ pre.numberSource code > span
41
+ { position: relative; left: -4em; counter-increment: source-line; }
42
+ pre.numberSource code > span > a:first-child::before
43
+ { content: counter(source-line);
44
+ position: relative; left: -1em; text-align: right; vertical-align: baseline;
45
+ border: none; display: inline-block;
46
+ -webkit-touch-callout: none; -webkit-user-select: none;
47
+ -khtml-user-select: none; -moz-user-select: none;
48
+ -ms-user-select: none; user-select: none;
49
+ padding: 0 4px; width: 4em;
50
+ }
51
+ pre.numberSource { margin-left: 3em; padding-left: 4px; }
52
+ div.sourceCode
53
+ { }
54
+ @media screen {
55
+ pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
56
+ }
57
+ </style>
58
+
59
+
60
+ <script src="site_libs/quarto-nav/quarto-nav.js"></script>
61
+ <script src="site_libs/quarto-nav/headroom.min.js"></script>
62
+ <script src="site_libs/clipboard/clipboard.min.js"></script>
63
+ <script src="site_libs/quarto-search/autocomplete.umd.js"></script>
64
+ <script src="site_libs/quarto-search/fuse.min.js"></script>
65
+ <script src="site_libs/quarto-search/quarto-search.js"></script>
66
+ <meta name="quarto:offset" content="./">
67
+ <link href="./cw017basic_op.html" rel="next">
68
+ <link href="./cw015no_spaces.html" rel="prev">
69
+ <link href="./logo.png" rel="icon" type="image/png">
70
+ <script src="site_libs/quarto-html/quarto.js"></script>
71
+ <script src="site_libs/quarto-html/popper.min.js"></script>
72
+ <script src="site_libs/quarto-html/tippy.umd.min.js"></script>
73
+ <script src="site_libs/quarto-html/anchor.min.js"></script>
74
+ <link href="site_libs/quarto-html/tippy.css" rel="stylesheet">
75
+ <link href="site_libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
76
+ <script src="site_libs/bootstrap/bootstrap.min.js"></script>
77
+ <link href="site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
78
+ <link href="site_libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
79
+ <link href="site_libs/quarto-contrib/badge/badge.css" rel="stylesheet">
80
+ <script id="quarto-search-options" type="application/json">{
81
+ "location": "sidebar",
82
+ "copy-button": false,
83
+ "collapse-after": 3,
84
+ "panel-placement": "start",
85
+ "type": "textbox",
86
+ "limit": 20,
87
+ "language": {
88
+ "search-no-results-text": "No results",
89
+ "search-matching-documents-text": "matching documents",
90
+ "search-copy-link-title": "Copy link to search",
91
+ "search-hide-matches-text": "Hide additional matches",
92
+ "search-more-match-text": "more match in this document",
93
+ "search-more-matches-text": "more matches in this document",
94
+ "search-clear-button-title": "Clear",
95
+ "search-detached-cancel-button-title": "Cancel",
96
+ "search-submit-button-title": "Submit",
97
+ "search-label": "Search"
98
+ }
99
+ }</script>
100
+
101
+
102
+ <meta name="twitter:title" content="Codewars Challenge 2024 Menggunakan R dan RStudio - 16&nbsp; Find the smallest integer in the array">
103
+ <meta name="twitter:description" content="">
104
+ <meta name="twitter:image" content="https://huggingface.co/spaces/aephidayatuloh/codewars2024/new_starcore_logo.png">
105
+ <meta name="twitter:image-height" content="434">
106
+ <meta name="twitter:image-width" content="1946">
107
+ <meta name="twitter:card" content="summary_large_image">
108
+ </head>
109
+
110
+ <body class="nav-sidebar floating">
111
+
112
+ <div id="quarto-search-results"></div>
113
+ <header id="quarto-header" class="headroom fixed-top">
114
+ <nav class="quarto-secondary-nav">
115
+ <div class="container-fluid d-flex">
116
+ <button type="button" class="quarto-btn-toggle btn" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
117
+ <i class="bi bi-layout-text-sidebar-reverse"></i>
118
+ </button>
119
+ <nav class="quarto-page-breadcrumbs" aria-label="breadcrumb"><ol class="breadcrumb"><li class="breadcrumb-item"><a href="./cw001evenodd.html">Februari</a></li><li class="breadcrumb-item"><a href="./cw016findSmallestInt.html"><span class="chapter-number">16</span>&nbsp; <span class="chapter-title">Find the smallest integer in the array</span></a></li></ol></nav>
120
+ <a class="flex-grow-1" role="button" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
121
+ </a>
122
+ <button type="button" class="btn quarto-search-button" aria-label="" onclick="window.quartoOpenSearch();">
123
+ <i class="bi bi-search"></i>
124
+ </button>
125
+ </div>
126
+ </nav>
127
+ </header>
128
+ <!-- content -->
129
+ <div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article">
130
+ <!-- sidebar -->
131
+ <nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal sidebar-navigation floating overflow-auto">
132
+ <div class="pt-lg-2 mt-2 text-left sidebar-header">
133
+ <div class="sidebar-title mb-0 py-0">
134
+ <a href="./">Codewars Challenge 2024 Menggunakan R dan RStudio</a>
135
+ <div class="sidebar-tools-main">
136
+ <a href="https://huggingface.co/spaces/aephidayatuloh/codewars2024/tree/main" rel="" title="Source Code" class="quarto-navigation-tool px-1" aria-label="Source Code"><i class="bi bi-git"></i></a>
137
+ </div>
138
+ </div>
139
+ </div>
140
+ <div class="mt-2 flex-shrink-0 align-items-center">
141
+ <div class="sidebar-search">
142
+ <div id="quarto-search" class="" title="Search"></div>
143
+ </div>
144
+ </div>
145
+ <div class="sidebar-menu-container">
146
+ <ul class="list-unstyled mt-1">
147
+ <li class="sidebar-item">
148
+ <div class="sidebar-item-container">
149
+ <a href="./index.html" class="sidebar-item-text sidebar-link">
150
+ <span class="menu-text">Pengantar</span></a>
151
+ </div>
152
+ </li>
153
+ <li class="sidebar-item sidebar-item-section">
154
+ <div class="sidebar-item-container">
155
+ <a class="sidebar-item-text sidebar-link text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" aria-expanded="true">
156
+ <span class="menu-text">Februari</span></a>
157
+ <a class="sidebar-item-toggle text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" aria-expanded="true" aria-label="Toggle section">
158
+ <i class="bi bi-chevron-right ms-2"></i>
159
+ </a>
160
+ </div>
161
+ <ul id="quarto-sidebar-section-1" class="collapse list-unstyled sidebar-section depth1 show">
162
+ <li class="sidebar-item">
163
+ <div class="sidebar-item-container">
164
+ <a href="./cw001evenodd.html" class="sidebar-item-text sidebar-link">
165
+ <span class="menu-text"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Even or Odd</span></span></a>
166
+ </div>
167
+ </li>
168
+ <li class="sidebar-item">
169
+ <div class="sidebar-item-container">
170
+ <a href="./cw002multiply.html" class="sidebar-item-text sidebar-link">
171
+ <span class="menu-text"><span class="chapter-number">2</span>&nbsp; <span class="chapter-title">Multiply</span></span></a>
172
+ </div>
173
+ </li>
174
+ <li class="sidebar-item">
175
+ <div class="sidebar-item-container">
176
+ <a href="./cw003countsheep.html" class="sidebar-item-text sidebar-link">
177
+ <span class="menu-text"><span class="chapter-number">3</span>&nbsp; <span class="chapter-title">If you can’t sleep, just count sheep!!</span></span></a>
178
+ </div>
179
+ </li>
180
+ <li class="sidebar-item">
181
+ <div class="sidebar-item-container">
182
+ <a href="./cw004reducegrow.html" class="sidebar-item-text sidebar-link">
183
+ <span class="menu-text"><span class="chapter-number">4</span>&nbsp; <span class="chapter-title">Beginner - Reduce but Grow</span></span></a>
184
+ </div>
185
+ </li>
186
+ <li class="sidebar-item">
187
+ <div class="sidebar-item-container">
188
+ <a href="./cw005make_negative.html" class="sidebar-item-text sidebar-link">
189
+ <span class="menu-text"><span class="chapter-number">5</span>&nbsp; <span class="chapter-title">Return Negative</span></span></a>
190
+ </div>
191
+ </li>
192
+ <li class="sidebar-item">
193
+ <div class="sidebar-item-container">
194
+ <a href="./cw006positive_sum.html" class="sidebar-item-text sidebar-link">
195
+ <span class="menu-text"><span class="chapter-number">6</span>&nbsp; <span class="chapter-title">Sum of positive</span></span></a>
196
+ </div>
197
+ </li>
198
+ <li class="sidebar-item">
199
+ <div class="sidebar-item-container">
200
+ <a href="./cw007reversedstrings.html" class="sidebar-item-text sidebar-link">
201
+ <span class="menu-text"><span class="chapter-number">7</span>&nbsp; <span class="chapter-title">Reversed Strings</span></span></a>
202
+ </div>
203
+ </li>
204
+ <li class="sidebar-item">
205
+ <div class="sidebar-item-container">
206
+ <a href="./cw008bool_to_word.html" class="sidebar-item-text sidebar-link">
207
+ <span class="menu-text"><span class="chapter-number">8</span>&nbsp; <span class="chapter-title">Convert boolean values to strings β€˜Yes’ or β€˜No’</span></span></a>
208
+ </div>
209
+ </li>
210
+ <li class="sidebar-item">
211
+ <div class="sidebar-item-container">
212
+ <a href="./cw009number_to_string.html" class="sidebar-item-text sidebar-link">
213
+ <span class="menu-text"><span class="chapter-number">9</span>&nbsp; <span class="chapter-title">Convert a Number to a String!</span></span></a>
214
+ </div>
215
+ </li>
216
+ <li class="sidebar-item">
217
+ <div class="sidebar-item-container">
218
+ <a href="./cw010opposite.html" class="sidebar-item-text sidebar-link">
219
+ <span class="menu-text"><span class="chapter-number">10</span>&nbsp; <span class="chapter-title">Opposite number</span></span></a>
220
+ </div>
221
+ </li>
222
+ <li class="sidebar-item">
223
+ <div class="sidebar-item-container">
224
+ <a href="./cw011removeChar.html" class="sidebar-item-text sidebar-link">
225
+ <span class="menu-text"><span class="chapter-number">11</span>&nbsp; <span class="chapter-title">Remove First and Last Character</span></span></a>
226
+ </div>
227
+ </li>
228
+ <li class="sidebar-item">
229
+ <div class="sidebar-item-container">
230
+ <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
231
+ <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
232
+ </div>
233
+ </li>
234
+ <li class="sidebar-item">
235
+ <div class="sidebar-item-container">
236
+ <a href="./cw013repeat_string.html" class="sidebar-item-text sidebar-link">
237
+ <span class="menu-text"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">String repeat</span></span></a>
238
+ </div>
239
+ </li>
240
+ <li class="sidebar-item">
241
+ <div class="sidebar-item-container">
242
+ <a href="./cw014summation.html" class="sidebar-item-text sidebar-link">
243
+ <span class="menu-text"><span class="chapter-number">14</span>&nbsp; <span class="chapter-title">Grasshopper - Summation</span></span></a>
244
+ </div>
245
+ </li>
246
+ <li class="sidebar-item">
247
+ <div class="sidebar-item-container">
248
+ <a href="./cw015no_spaces.html" class="sidebar-item-text sidebar-link">
249
+ <span class="menu-text"><span class="chapter-number">15</span>&nbsp; <span class="chapter-title">Remove String Spaces</span></span></a>
250
+ </div>
251
+ </li>
252
+ <li class="sidebar-item">
253
+ <div class="sidebar-item-container">
254
+ <a href="./cw016findSmallestInt.html" class="sidebar-item-text sidebar-link active">
255
+ <span class="menu-text"><span class="chapter-number">16</span>&nbsp; <span class="chapter-title">Find the smallest integer in the array</span></span></a>
256
+ </div>
257
+ </li>
258
+ <li class="sidebar-item">
259
+ <div class="sidebar-item-container">
260
+ <a href="./cw017basic_op.html" class="sidebar-item-text sidebar-link">
261
+ <span class="menu-text"><span class="chapter-number">17</span>&nbsp; <span class="chapter-title">Basic Mathematical Operations</span></span></a>
262
+ </div>
263
+ </li>
264
+ </ul>
265
+ </li>
266
+ </ul>
267
+ </div>
268
+ </nav>
269
+ <div id="quarto-sidebar-glass" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass"></div>
270
+ <!-- margin-sidebar -->
271
+ <div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
272
+ <nav id="TOC" role="doc-toc" class="toc-active">
273
+ <h2 id="toc-title">Table of contents</h2>
274
+
275
+ <ul>
276
+ <li><a href="#instruction" id="toc-instruction" class="nav-link active" data-scroll-target="#instruction"><span class="header-section-number">16.1</span> Instruction</a></li>
277
+ <li><a href="#youtube-video" id="toc-youtube-video" class="nav-link" data-scroll-target="#youtube-video"><span class="header-section-number">16.2</span> YouTube Video</a></li>
278
+ <li><a href="#solution-code" id="toc-solution-code" class="nav-link" data-scroll-target="#solution-code"><span class="header-section-number">16.3</span> Solution Code</a></li>
279
+ <li><a href="#test" id="toc-test" class="nav-link" data-scroll-target="#test"><span class="header-section-number">16.4</span> Test</a></li>
280
+ <li><a href="#supported-by" id="toc-supported-by" class="nav-link" data-scroll-target="#supported-by"><span class="header-section-number">16.5</span> Supported by</a></li>
281
+ </ul>
282
+ </nav>
283
+ </div>
284
+ <!-- main -->
285
+ <main class="content" id="quarto-document-content">
286
+
287
+ <header id="title-block-header" class="quarto-title-block default">
288
+ <div class="quarto-title">
289
+ <h1 class="title"><span class="chapter-number">16</span>&nbsp; <span class="chapter-title">Find the smallest integer in the array</span></h1>
290
+ </div>
291
+
292
+
293
+
294
+ <div class="quarto-title-meta">
295
+
296
+
297
+
298
+
299
+ </div>
300
+
301
+
302
+ </header>
303
+
304
+ <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Tantangan #16/366 - 01 Mar 2024</p>
305
+ <p><a href="https://www.codewars.com/kata/55a2d7ebe362935a210000b2" class="uri">https://www.codewars.com/kata/55a2d7ebe362935a210000b2</a></p>
306
+ <section id="instruction" class="level2" data-number="16.1">
307
+ <h2 data-number="16.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">16.1</span> Instruction</h2>
308
+ <p>Given an array of integers your solution should find the smallest integer.</p>
309
+ <p>For example:</p>
310
+ <p>Given <code>[34, 15, 88, 2]</code> your solution will return <code>2</code><br>
311
+ Given <code>[34, -345, -1, 100]</code> your solution will return <code>-345</code><br>
312
+ You can assume, for the purpose of this kata, that the supplied array will not be empty.</p>
313
+ </section>
314
+ <section id="youtube-video" class="level2" data-number="16.2">
315
+ <h2 data-number="16.2" class="anchored" data-anchor-id="youtube-video"><span class="header-section-number">16.2</span> YouTube Video</h2>
316
+ <div class="quarto-video ratio ratio-16x9"><iframe data-external="1" src="https://www.youtube.com/embed/L8aczEhqymk?si=DSx84acpNvbkucrK" title="" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe></div>
317
+ </section>
318
+ <section id="solution-code" class="level2" data-number="16.3">
319
+ <h2 data-number="16.3" class="anchored" data-anchor-id="solution-code"><span class="header-section-number">16.3</span> Solution Code</h2>
320
+ <div class="cell">
321
+ <div class="sourceCode cell-code" id="cb1"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a>findSmallestInt <span class="ot">&lt;-</span> <span class="cf">function</span>(arr){</span>
322
+ <span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">min</span>(arr)</span>
323
+ <span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a>}</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
324
+ </div>
325
+ <div class="cell">
326
+ <div class="sourceCode cell-code" id="cb2"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>findSmallestInt <span class="ot">&lt;-</span> min</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
327
+ </div>
328
+ </section>
329
+ <section id="test" class="level2" data-number="16.4">
330
+ <h2 data-number="16.4" class="anchored" data-anchor-id="test"><span class="header-section-number">16.4</span> Test</h2>
331
+ <div class="cell">
332
+ <div class="sourceCode cell-code" id="cb3"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(testthat)</span>
333
+ <span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a></span>
334
+ <span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a><span class="fu">test_that</span>(<span class="st">"Sample Tests"</span>, {</span>
335
+ <span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">findSmallestInt</span>(<span class="fu">c</span>(<span class="dv">78</span>,<span class="dv">56</span>,<span class="dv">232</span>,<span class="dv">12</span>,<span class="dv">11</span>,<span class="dv">43</span>)), <span class="dv">11</span>)</span>
336
+ <span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">findSmallestInt</span>(<span class="fu">c</span>(<span class="dv">78</span>,<span class="dv">56</span>,<span class="sc">-</span><span class="dv">2</span>,<span class="dv">12</span>,<span class="dv">8</span>,<span class="sc">-</span><span class="dv">33</span>)), <span class="sc">-</span><span class="dv">33</span>)</span>
337
+ <span id="cb3-6"><a href="#cb3-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">findSmallestInt</span>(<span class="fu">c</span>(<span class="dv">0</span>, <span class="sc">-</span><span class="dv">1</span><span class="sc">-</span>.Machine<span class="sc">$</span>integer.max)), <span class="sc">-</span><span class="dv">1</span><span class="sc">-</span>.Machine<span class="sc">$</span>integer.max)</span>
338
+ <span id="cb3-7"><a href="#cb3-7" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
339
+ <div class="cell-output cell-output-stdout">
340
+ <pre><code>Test passed 🎊</code></pre>
341
+ </div>
342
+ </div>
343
+ </section>
344
+ <section id="supported-by" class="level2" data-number="16.5">
345
+ <h2 data-number="16.5" class="anchored" data-anchor-id="supported-by"><span class="header-section-number">16.5</span> Supported by</h2>
346
+ <div class="quarto-figure quarto-figure-center">
347
+ <figure class="figure">
348
+ <p><a href="https://www.starcore.co"><img src="new_starcore_logo.png" class="img-fluid figure-img"></a></p>
349
+ <figcaption class="figure-caption">StarCore Analytics</figcaption>
350
+ </figure>
351
+ </div>
352
+
353
+
354
+ </section>
355
+
356
+ </main> <!-- /main -->
357
+ <script id="quarto-html-after-body" type="application/javascript">
358
+ window.document.addEventListener("DOMContentLoaded", function (event) {
359
+ const toggleBodyColorMode = (bsSheetEl) => {
360
+ const mode = bsSheetEl.getAttribute("data-mode");
361
+ const bodyEl = window.document.querySelector("body");
362
+ if (mode === "dark") {
363
+ bodyEl.classList.add("quarto-dark");
364
+ bodyEl.classList.remove("quarto-light");
365
+ } else {
366
+ bodyEl.classList.add("quarto-light");
367
+ bodyEl.classList.remove("quarto-dark");
368
+ }
369
+ }
370
+ const toggleBodyColorPrimary = () => {
371
+ const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
372
+ if (bsSheetEl) {
373
+ toggleBodyColorMode(bsSheetEl);
374
+ }
375
+ }
376
+ toggleBodyColorPrimary();
377
+ const icon = "";
378
+ const anchorJS = new window.AnchorJS();
379
+ anchorJS.options = {
380
+ placement: 'right',
381
+ icon: icon
382
+ };
383
+ anchorJS.add('.anchored');
384
+ const isCodeAnnotation = (el) => {
385
+ for (const clz of el.classList) {
386
+ if (clz.startsWith('code-annotation-')) {
387
+ return true;
388
+ }
389
+ }
390
+ return false;
391
+ }
392
+ const clipboard = new window.ClipboardJS('.code-copy-button', {
393
+ text: function(trigger) {
394
+ const codeEl = trigger.previousElementSibling.cloneNode(true);
395
+ for (const childEl of codeEl.children) {
396
+ if (isCodeAnnotation(childEl)) {
397
+ childEl.remove();
398
+ }
399
+ }
400
+ return codeEl.innerText;
401
+ }
402
+ });
403
+ clipboard.on('success', function(e) {
404
+ // button target
405
+ const button = e.trigger;
406
+ // don't keep focus
407
+ button.blur();
408
+ // flash "checked"
409
+ button.classList.add('code-copy-button-checked');
410
+ var currentTitle = button.getAttribute("title");
411
+ button.setAttribute("title", "Copied!");
412
+ let tooltip;
413
+ if (window.bootstrap) {
414
+ button.setAttribute("data-bs-toggle", "tooltip");
415
+ button.setAttribute("data-bs-placement", "left");
416
+ button.setAttribute("data-bs-title", "Copied!");
417
+ tooltip = new bootstrap.Tooltip(button,
418
+ { trigger: "manual",
419
+ customClass: "code-copy-button-tooltip",
420
+ offset: [0, -8]});
421
+ tooltip.show();
422
+ }
423
+ setTimeout(function() {
424
+ if (tooltip) {
425
+ tooltip.hide();
426
+ button.removeAttribute("data-bs-title");
427
+ button.removeAttribute("data-bs-toggle");
428
+ button.removeAttribute("data-bs-placement");
429
+ }
430
+ button.setAttribute("title", currentTitle);
431
+ button.classList.remove('code-copy-button-checked');
432
+ }, 1000);
433
+ // clear code selection
434
+ e.clearSelection();
435
+ });
436
+ function tippyHover(el, contentFn) {
437
+ const config = {
438
+ allowHTML: true,
439
+ content: contentFn,
440
+ maxWidth: 500,
441
+ delay: 100,
442
+ arrow: false,
443
+ appendTo: function(el) {
444
+ return el.parentElement;
445
+ },
446
+ interactive: true,
447
+ interactiveBorder: 10,
448
+ theme: 'quarto',
449
+ placement: 'bottom-start'
450
+ };
451
+ window.tippy(el, config);
452
+ }
453
+ const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
454
+ for (var i=0; i<noterefs.length; i++) {
455
+ const ref = noterefs[i];
456
+ tippyHover(ref, function() {
457
+ // use id or data attribute instead here
458
+ let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
459
+ try { href = new URL(href).hash; } catch {}
460
+ const id = href.replace(/^#\/?/, "");
461
+ const note = window.document.getElementById(id);
462
+ return note.innerHTML;
463
+ });
464
+ }
465
+ let selectedAnnoteEl;
466
+ const selectorForAnnotation = ( cell, annotation) => {
467
+ let cellAttr = 'data-code-cell="' + cell + '"';
468
+ let lineAttr = 'data-code-annotation="' + annotation + '"';
469
+ const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
470
+ return selector;
471
+ }
472
+ const selectCodeLines = (annoteEl) => {
473
+ const doc = window.document;
474
+ const targetCell = annoteEl.getAttribute("data-target-cell");
475
+ const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
476
+ const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
477
+ const lines = annoteSpan.getAttribute("data-code-lines").split(",");
478
+ const lineIds = lines.map((line) => {
479
+ return targetCell + "-" + line;
480
+ })
481
+ let top = null;
482
+ let height = null;
483
+ let parent = null;
484
+ if (lineIds.length > 0) {
485
+ //compute the position of the single el (top and bottom and make a div)
486
+ const el = window.document.getElementById(lineIds[0]);
487
+ top = el.offsetTop;
488
+ height = el.offsetHeight;
489
+ parent = el.parentElement.parentElement;
490
+ if (lineIds.length > 1) {
491
+ const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
492
+ const bottom = lastEl.offsetTop + lastEl.offsetHeight;
493
+ height = bottom - top;
494
+ }
495
+ if (top !== null && height !== null && parent !== null) {
496
+ // cook up a div (if necessary) and position it
497
+ let div = window.document.getElementById("code-annotation-line-highlight");
498
+ if (div === null) {
499
+ div = window.document.createElement("div");
500
+ div.setAttribute("id", "code-annotation-line-highlight");
501
+ div.style.position = 'absolute';
502
+ parent.appendChild(div);
503
+ }
504
+ div.style.top = top - 2 + "px";
505
+ div.style.height = height + 4 + "px";
506
+ let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
507
+ if (gutterDiv === null) {
508
+ gutterDiv = window.document.createElement("div");
509
+ gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
510
+ gutterDiv.style.position = 'absolute';
511
+ const codeCell = window.document.getElementById(targetCell);
512
+ const gutter = codeCell.querySelector('.code-annotation-gutter');
513
+ gutter.appendChild(gutterDiv);
514
+ }
515
+ gutterDiv.style.top = top - 2 + "px";
516
+ gutterDiv.style.height = height + 4 + "px";
517
+ }
518
+ selectedAnnoteEl = annoteEl;
519
+ }
520
+ };
521
+ const unselectCodeLines = () => {
522
+ const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
523
+ elementsIds.forEach((elId) => {
524
+ const div = window.document.getElementById(elId);
525
+ if (div) {
526
+ div.remove();
527
+ }
528
+ });
529
+ selectedAnnoteEl = undefined;
530
+ };
531
+ // Attach click handler to the DT
532
+ const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
533
+ for (const annoteDlNode of annoteDls) {
534
+ annoteDlNode.addEventListener('click', (event) => {
535
+ const clickedEl = event.target;
536
+ if (clickedEl !== selectedAnnoteEl) {
537
+ unselectCodeLines();
538
+ const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
539
+ if (activeEl) {
540
+ activeEl.classList.remove('code-annotation-active');
541
+ }
542
+ selectCodeLines(clickedEl);
543
+ clickedEl.classList.add('code-annotation-active');
544
+ } else {
545
+ // Unselect the line
546
+ unselectCodeLines();
547
+ clickedEl.classList.remove('code-annotation-active');
548
+ }
549
+ });
550
+ }
551
+ const findCites = (el) => {
552
+ const parentEl = el.parentElement;
553
+ if (parentEl) {
554
+ const cites = parentEl.dataset.cites;
555
+ if (cites) {
556
+ return {
557
+ el,
558
+ cites: cites.split(' ')
559
+ };
560
+ } else {
561
+ return findCites(el.parentElement)
562
+ }
563
+ } else {
564
+ return undefined;
565
+ }
566
+ };
567
+ var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
568
+ for (var i=0; i<bibliorefs.length; i++) {
569
+ const ref = bibliorefs[i];
570
+ const citeInfo = findCites(ref);
571
+ if (citeInfo) {
572
+ tippyHover(citeInfo.el, function() {
573
+ var popup = window.document.createElement('div');
574
+ citeInfo.cites.forEach(function(cite) {
575
+ var citeDiv = window.document.createElement('div');
576
+ citeDiv.classList.add('hanging-indent');
577
+ citeDiv.classList.add('csl-entry');
578
+ var biblioDiv = window.document.getElementById('ref-' + cite);
579
+ if (biblioDiv) {
580
+ citeDiv.innerHTML = biblioDiv.innerHTML;
581
+ }
582
+ popup.appendChild(citeDiv);
583
+ });
584
+ return popup.innerHTML;
585
+ });
586
+ }
587
+ }
588
+ });
589
+ </script>
590
+ <nav class="page-navigation">
591
+ <div class="nav-page nav-page-previous">
592
+ <a href="./cw015no_spaces.html" class="pagination-link">
593
+ <i class="bi bi-arrow-left-short"></i> <span class="nav-page-text"><span class="chapter-number">15</span>&nbsp; <span class="chapter-title">Remove String Spaces</span></span>
594
+ </a>
595
+ </div>
596
+ <div class="nav-page nav-page-next">
597
+ <a href="./cw017basic_op.html" class="pagination-link">
598
+ <span class="nav-page-text"><span class="chapter-number">17</span>&nbsp; <span class="chapter-title">Basic Mathematical Operations</span></span> <i class="bi bi-arrow-right-short"></i>
599
+ </a>
600
+ </div>
601
+ </nav>
602
+ </div> <!-- /content -->
603
+
604
+
605
+
606
+ </body></html>
cw017basic_op.html ADDED
@@ -0,0 +1,609 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
3
+
4
+ <meta charset="utf-8">
5
+ <meta name="generator" content="quarto-1.3.433">
6
+
7
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
8
+
9
+
10
+ <title>Codewars Challenge 2024 Menggunakan R dan RStudio - 17&nbsp; Basic Mathematical Operations</title>
11
+ <style>
12
+ code{white-space: pre-wrap;}
13
+ span.smallcaps{font-variant: small-caps;}
14
+ div.columns{display: flex; gap: min(4vw, 1.5em);}
15
+ div.column{flex: auto; overflow-x: auto;}
16
+ div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
17
+ ul.task-list{list-style: none;}
18
+ ul.task-list li input[type="checkbox"] {
19
+ width: 0.8em;
20
+ margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
21
+ vertical-align: middle;
22
+ }
23
+ /* CSS for syntax highlighting */
24
+ pre > code.sourceCode { white-space: pre; position: relative; }
25
+ pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
26
+ pre > code.sourceCode > span:empty { height: 1.2em; }
27
+ .sourceCode { overflow: visible; }
28
+ code.sourceCode > span { color: inherit; text-decoration: inherit; }
29
+ div.sourceCode { margin: 1em 0; }
30
+ pre.sourceCode { margin: 0; }
31
+ @media screen {
32
+ div.sourceCode { overflow: auto; }
33
+ }
34
+ @media print {
35
+ pre > code.sourceCode { white-space: pre-wrap; }
36
+ pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
37
+ }
38
+ pre.numberSource code
39
+ { counter-reset: source-line 0; }
40
+ pre.numberSource code > span
41
+ { position: relative; left: -4em; counter-increment: source-line; }
42
+ pre.numberSource code > span > a:first-child::before
43
+ { content: counter(source-line);
44
+ position: relative; left: -1em; text-align: right; vertical-align: baseline;
45
+ border: none; display: inline-block;
46
+ -webkit-touch-callout: none; -webkit-user-select: none;
47
+ -khtml-user-select: none; -moz-user-select: none;
48
+ -ms-user-select: none; user-select: none;
49
+ padding: 0 4px; width: 4em;
50
+ }
51
+ pre.numberSource { margin-left: 3em; padding-left: 4px; }
52
+ div.sourceCode
53
+ { }
54
+ @media screen {
55
+ pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
56
+ }
57
+ </style>
58
+
59
+
60
+ <script src="site_libs/quarto-nav/quarto-nav.js"></script>
61
+ <script src="site_libs/quarto-nav/headroom.min.js"></script>
62
+ <script src="site_libs/clipboard/clipboard.min.js"></script>
63
+ <script src="site_libs/quarto-search/autocomplete.umd.js"></script>
64
+ <script src="site_libs/quarto-search/fuse.min.js"></script>
65
+ <script src="site_libs/quarto-search/quarto-search.js"></script>
66
+ <meta name="quarto:offset" content="./">
67
+ <link href="./cw016findSmallestInt.html" rel="prev">
68
+ <link href="./logo.png" rel="icon" type="image/png">
69
+ <script src="site_libs/quarto-html/quarto.js"></script>
70
+ <script src="site_libs/quarto-html/popper.min.js"></script>
71
+ <script src="site_libs/quarto-html/tippy.umd.min.js"></script>
72
+ <script src="site_libs/quarto-html/anchor.min.js"></script>
73
+ <link href="site_libs/quarto-html/tippy.css" rel="stylesheet">
74
+ <link href="site_libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
75
+ <script src="site_libs/bootstrap/bootstrap.min.js"></script>
76
+ <link href="site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
77
+ <link href="site_libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
78
+ <link href="site_libs/quarto-contrib/badge/badge.css" rel="stylesheet">
79
+ <script id="quarto-search-options" type="application/json">{
80
+ "location": "sidebar",
81
+ "copy-button": false,
82
+ "collapse-after": 3,
83
+ "panel-placement": "start",
84
+ "type": "textbox",
85
+ "limit": 20,
86
+ "language": {
87
+ "search-no-results-text": "No results",
88
+ "search-matching-documents-text": "matching documents",
89
+ "search-copy-link-title": "Copy link to search",
90
+ "search-hide-matches-text": "Hide additional matches",
91
+ "search-more-match-text": "more match in this document",
92
+ "search-more-matches-text": "more matches in this document",
93
+ "search-clear-button-title": "Clear",
94
+ "search-detached-cancel-button-title": "Cancel",
95
+ "search-submit-button-title": "Submit",
96
+ "search-label": "Search"
97
+ }
98
+ }</script>
99
+
100
+
101
+ <meta name="twitter:title" content="Codewars Challenge 2024 Menggunakan R dan RStudio - 17&nbsp; Basic Mathematical Operations">
102
+ <meta name="twitter:description" content="">
103
+ <meta name="twitter:image" content="https://huggingface.co/spaces/aephidayatuloh/codewars2024/new_starcore_logo.png">
104
+ <meta name="twitter:image-height" content="434">
105
+ <meta name="twitter:image-width" content="1946">
106
+ <meta name="twitter:card" content="summary_large_image">
107
+ </head>
108
+
109
+ <body class="nav-sidebar floating">
110
+
111
+ <div id="quarto-search-results"></div>
112
+ <header id="quarto-header" class="headroom fixed-top">
113
+ <nav class="quarto-secondary-nav">
114
+ <div class="container-fluid d-flex">
115
+ <button type="button" class="quarto-btn-toggle btn" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
116
+ <i class="bi bi-layout-text-sidebar-reverse"></i>
117
+ </button>
118
+ <nav class="quarto-page-breadcrumbs" aria-label="breadcrumb"><ol class="breadcrumb"><li class="breadcrumb-item"><a href="./cw001evenodd.html">Februari</a></li><li class="breadcrumb-item"><a href="./cw017basic_op.html"><span class="chapter-number">17</span>&nbsp; <span class="chapter-title">Basic Mathematical Operations</span></a></li></ol></nav>
119
+ <a class="flex-grow-1" role="button" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
120
+ </a>
121
+ <button type="button" class="btn quarto-search-button" aria-label="" onclick="window.quartoOpenSearch();">
122
+ <i class="bi bi-search"></i>
123
+ </button>
124
+ </div>
125
+ </nav>
126
+ </header>
127
+ <!-- content -->
128
+ <div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article">
129
+ <!-- sidebar -->
130
+ <nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal sidebar-navigation floating overflow-auto">
131
+ <div class="pt-lg-2 mt-2 text-left sidebar-header">
132
+ <div class="sidebar-title mb-0 py-0">
133
+ <a href="./">Codewars Challenge 2024 Menggunakan R dan RStudio</a>
134
+ <div class="sidebar-tools-main">
135
+ <a href="https://huggingface.co/spaces/aephidayatuloh/codewars2024/tree/main" rel="" title="Source Code" class="quarto-navigation-tool px-1" aria-label="Source Code"><i class="bi bi-git"></i></a>
136
+ </div>
137
+ </div>
138
+ </div>
139
+ <div class="mt-2 flex-shrink-0 align-items-center">
140
+ <div class="sidebar-search">
141
+ <div id="quarto-search" class="" title="Search"></div>
142
+ </div>
143
+ </div>
144
+ <div class="sidebar-menu-container">
145
+ <ul class="list-unstyled mt-1">
146
+ <li class="sidebar-item">
147
+ <div class="sidebar-item-container">
148
+ <a href="./index.html" class="sidebar-item-text sidebar-link">
149
+ <span class="menu-text">Pengantar</span></a>
150
+ </div>
151
+ </li>
152
+ <li class="sidebar-item sidebar-item-section">
153
+ <div class="sidebar-item-container">
154
+ <a class="sidebar-item-text sidebar-link text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" aria-expanded="true">
155
+ <span class="menu-text">Februari</span></a>
156
+ <a class="sidebar-item-toggle text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" aria-expanded="true" aria-label="Toggle section">
157
+ <i class="bi bi-chevron-right ms-2"></i>
158
+ </a>
159
+ </div>
160
+ <ul id="quarto-sidebar-section-1" class="collapse list-unstyled sidebar-section depth1 show">
161
+ <li class="sidebar-item">
162
+ <div class="sidebar-item-container">
163
+ <a href="./cw001evenodd.html" class="sidebar-item-text sidebar-link">
164
+ <span class="menu-text"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Even or Odd</span></span></a>
165
+ </div>
166
+ </li>
167
+ <li class="sidebar-item">
168
+ <div class="sidebar-item-container">
169
+ <a href="./cw002multiply.html" class="sidebar-item-text sidebar-link">
170
+ <span class="menu-text"><span class="chapter-number">2</span>&nbsp; <span class="chapter-title">Multiply</span></span></a>
171
+ </div>
172
+ </li>
173
+ <li class="sidebar-item">
174
+ <div class="sidebar-item-container">
175
+ <a href="./cw003countsheep.html" class="sidebar-item-text sidebar-link">
176
+ <span class="menu-text"><span class="chapter-number">3</span>&nbsp; <span class="chapter-title">If you can’t sleep, just count sheep!!</span></span></a>
177
+ </div>
178
+ </li>
179
+ <li class="sidebar-item">
180
+ <div class="sidebar-item-container">
181
+ <a href="./cw004reducegrow.html" class="sidebar-item-text sidebar-link">
182
+ <span class="menu-text"><span class="chapter-number">4</span>&nbsp; <span class="chapter-title">Beginner - Reduce but Grow</span></span></a>
183
+ </div>
184
+ </li>
185
+ <li class="sidebar-item">
186
+ <div class="sidebar-item-container">
187
+ <a href="./cw005make_negative.html" class="sidebar-item-text sidebar-link">
188
+ <span class="menu-text"><span class="chapter-number">5</span>&nbsp; <span class="chapter-title">Return Negative</span></span></a>
189
+ </div>
190
+ </li>
191
+ <li class="sidebar-item">
192
+ <div class="sidebar-item-container">
193
+ <a href="./cw006positive_sum.html" class="sidebar-item-text sidebar-link">
194
+ <span class="menu-text"><span class="chapter-number">6</span>&nbsp; <span class="chapter-title">Sum of positive</span></span></a>
195
+ </div>
196
+ </li>
197
+ <li class="sidebar-item">
198
+ <div class="sidebar-item-container">
199
+ <a href="./cw007reversedstrings.html" class="sidebar-item-text sidebar-link">
200
+ <span class="menu-text"><span class="chapter-number">7</span>&nbsp; <span class="chapter-title">Reversed Strings</span></span></a>
201
+ </div>
202
+ </li>
203
+ <li class="sidebar-item">
204
+ <div class="sidebar-item-container">
205
+ <a href="./cw008bool_to_word.html" class="sidebar-item-text sidebar-link">
206
+ <span class="menu-text"><span class="chapter-number">8</span>&nbsp; <span class="chapter-title">Convert boolean values to strings β€˜Yes’ or β€˜No’</span></span></a>
207
+ </div>
208
+ </li>
209
+ <li class="sidebar-item">
210
+ <div class="sidebar-item-container">
211
+ <a href="./cw009number_to_string.html" class="sidebar-item-text sidebar-link">
212
+ <span class="menu-text"><span class="chapter-number">9</span>&nbsp; <span class="chapter-title">Convert a Number to a String!</span></span></a>
213
+ </div>
214
+ </li>
215
+ <li class="sidebar-item">
216
+ <div class="sidebar-item-container">
217
+ <a href="./cw010opposite.html" class="sidebar-item-text sidebar-link">
218
+ <span class="menu-text"><span class="chapter-number">10</span>&nbsp; <span class="chapter-title">Opposite number</span></span></a>
219
+ </div>
220
+ </li>
221
+ <li class="sidebar-item">
222
+ <div class="sidebar-item-container">
223
+ <a href="./cw011removeChar.html" class="sidebar-item-text sidebar-link">
224
+ <span class="menu-text"><span class="chapter-number">11</span>&nbsp; <span class="chapter-title">Remove First and Last Character</span></span></a>
225
+ </div>
226
+ </li>
227
+ <li class="sidebar-item">
228
+ <div class="sidebar-item-container">
229
+ <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
230
+ <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
231
+ </div>
232
+ </li>
233
+ <li class="sidebar-item">
234
+ <div class="sidebar-item-container">
235
+ <a href="./cw013repeat_string.html" class="sidebar-item-text sidebar-link">
236
+ <span class="menu-text"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">String repeat</span></span></a>
237
+ </div>
238
+ </li>
239
+ <li class="sidebar-item">
240
+ <div class="sidebar-item-container">
241
+ <a href="./cw014summation.html" class="sidebar-item-text sidebar-link">
242
+ <span class="menu-text"><span class="chapter-number">14</span>&nbsp; <span class="chapter-title">Grasshopper - Summation</span></span></a>
243
+ </div>
244
+ </li>
245
+ <li class="sidebar-item">
246
+ <div class="sidebar-item-container">
247
+ <a href="./cw015no_spaces.html" class="sidebar-item-text sidebar-link">
248
+ <span class="menu-text"><span class="chapter-number">15</span>&nbsp; <span class="chapter-title">Remove String Spaces</span></span></a>
249
+ </div>
250
+ </li>
251
+ <li class="sidebar-item">
252
+ <div class="sidebar-item-container">
253
+ <a href="./cw016findSmallestInt.html" class="sidebar-item-text sidebar-link">
254
+ <span class="menu-text"><span class="chapter-number">16</span>&nbsp; <span class="chapter-title">Find the smallest integer in the array</span></span></a>
255
+ </div>
256
+ </li>
257
+ <li class="sidebar-item">
258
+ <div class="sidebar-item-container">
259
+ <a href="./cw017basic_op.html" class="sidebar-item-text sidebar-link active">
260
+ <span class="menu-text"><span class="chapter-number">17</span>&nbsp; <span class="chapter-title">Basic Mathematical Operations</span></span></a>
261
+ </div>
262
+ </li>
263
+ </ul>
264
+ </li>
265
+ </ul>
266
+ </div>
267
+ </nav>
268
+ <div id="quarto-sidebar-glass" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass"></div>
269
+ <!-- margin-sidebar -->
270
+ <div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
271
+ <nav id="TOC" role="doc-toc" class="toc-active">
272
+ <h2 id="toc-title">Table of contents</h2>
273
+
274
+ <ul>
275
+ <li><a href="#instruction" id="toc-instruction" class="nav-link active" data-scroll-target="#instruction"><span class="header-section-number">17.1</span> Instruction</a></li>
276
+ <li><a href="#youtube-video" id="toc-youtube-video" class="nav-link" data-scroll-target="#youtube-video"><span class="header-section-number">17.2</span> YouTube Video</a></li>
277
+ <li><a href="#solution-code" id="toc-solution-code" class="nav-link" data-scroll-target="#solution-code"><span class="header-section-number">17.3</span> Solution Code</a></li>
278
+ <li><a href="#test" id="toc-test" class="nav-link" data-scroll-target="#test"><span class="header-section-number">17.4</span> Test</a></li>
279
+ <li><a href="#supported-by" id="toc-supported-by" class="nav-link" data-scroll-target="#supported-by"><span class="header-section-number">17.5</span> Supported by</a></li>
280
+ </ul>
281
+ </nav>
282
+ </div>
283
+ <!-- main -->
284
+ <main class="content" id="quarto-document-content">
285
+
286
+ <header id="title-block-header" class="quarto-title-block default">
287
+ <div class="quarto-title">
288
+ <h1 class="title"><span class="chapter-number">17</span>&nbsp; <span class="chapter-title">Basic Mathematical Operations</span></h1>
289
+ </div>
290
+
291
+
292
+
293
+ <div class="quarto-title-meta">
294
+
295
+
296
+
297
+
298
+ </div>
299
+
300
+
301
+ </header>
302
+
303
+ <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Tantangan #17/366 - 02 Mar 2024</p>
304
+ <p><a href="https://www.codewars.com/kata/57356c55867b9b7a60000bd7" class="uri">https://www.codewars.com/kata/57356c55867b9b7a60000bd7</a></p>
305
+ <section id="instruction" class="level2" data-number="17.1">
306
+ <h2 data-number="17.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">17.1</span> Instruction</h2>
307
+ <p>Your task is to create a function that does four basic mathematical operations.</p>
308
+ <p>The function should take three arguments - operation(string/char), value1(number), value2(number). The function should return result of numbers after applying the chosen operation.</p>
309
+ <p><strong>Examples(Operator, value1, value2) –&gt; output</strong></p>
310
+ <div class="cell">
311
+ <div class="sourceCode cell-code" id="cb1"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a>(<span class="st">'+'</span>, <span class="dv">4</span>, <span class="dv">7</span>) <span class="sc">-</span><span class="ot">-&gt;</span> <span class="dv">11</span></span>
312
+ <span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a>(<span class="st">'-'</span>, <span class="dv">15</span>, <span class="dv">18</span>) <span class="sc">-</span><span class="ot">-&gt;</span> <span class="sc">-</span><span class="dv">3</span></span>
313
+ <span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a>(<span class="st">'*'</span>, <span class="dv">5</span>, <span class="dv">5</span>) <span class="sc">-</span><span class="ot">-&gt;</span> <span class="dv">25</span></span>
314
+ <span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a>(<span class="st">'/'</span>, <span class="dv">49</span>, <span class="dv">7</span>) <span class="sc">-</span><span class="ot">-&gt;</span> <span class="dv">7</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
315
+ </div>
316
+ </section>
317
+ <section id="youtube-video" class="level2" data-number="17.2">
318
+ <h2 data-number="17.2" class="anchored" data-anchor-id="youtube-video"><span class="header-section-number">17.2</span> YouTube Video</h2>
319
+ <div class="quarto-video ratio ratio-16x9"><iframe data-external="1" src="https://www.youtube.com/embed/L8aczEhqymk?si=DSx84acpNvbkucrK" title="" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe></div>
320
+ </section>
321
+ <section id="solution-code" class="level2" data-number="17.3">
322
+ <h2 data-number="17.3" class="anchored" data-anchor-id="solution-code"><span class="header-section-number">17.3</span> Solution Code</h2>
323
+ <div class="cell">
324
+ <div class="sourceCode cell-code" id="cb2"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>basic_op <span class="ot">&lt;-</span> <span class="cf">function</span>(operator, value1, value2){</span>
325
+ <span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">eval</span>(<span class="fu">parse</span>(<span class="at">text =</span> <span class="fu">paste0</span>(value1, operator, value2)))</span>
326
+ <span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a>}</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
327
+ </div>
328
+ <div class="cell">
329
+ <div class="sourceCode cell-code" id="cb3"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a>basic_op <span class="ot">&lt;-</span> <span class="cf">function</span>(operator, value1, value2){</span>
330
+ <span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">eval</span>(<span class="fu">str2lang</span>(<span class="fu">paste0</span>(value1, operator, value2)))</span>
331
+ <span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a>}</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
332
+ </div>
333
+ </section>
334
+ <section id="test" class="level2" data-number="17.4">
335
+ <h2 data-number="17.4" class="anchored" data-anchor-id="test"><span class="header-section-number">17.4</span> Test</h2>
336
+ <div class="cell">
337
+ <div class="sourceCode cell-code" id="cb4"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(testthat)</span>
338
+ <span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a></span>
339
+ <span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="fu">test_that</span>(<span class="st">'Basic tests'</span>, {</span>
340
+ <span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">basic_op</span>(<span class="st">'+'</span>, <span class="dv">4</span>, <span class="dv">7</span>), <span class="dv">11</span>)</span>
341
+ <span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">basic_op</span>(<span class="st">'-'</span>, <span class="dv">15</span>, <span class="dv">18</span>), <span class="sc">-</span><span class="dv">3</span>)</span>
342
+ <span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">basic_op</span>(<span class="st">'*'</span>, <span class="dv">5</span>, <span class="dv">5</span>), <span class="dv">25</span>)</span>
343
+ <span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">basic_op</span>(<span class="st">'/'</span>, <span class="dv">49</span>, <span class="dv">7</span>), <span class="dv">7</span>)</span>
344
+ <span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
345
+ <div class="cell-output cell-output-stdout">
346
+ <pre><code>Test passed 🎊</code></pre>
347
+ </div>
348
+ </div>
349
+ </section>
350
+ <section id="supported-by" class="level2" data-number="17.5">
351
+ <h2 data-number="17.5" class="anchored" data-anchor-id="supported-by"><span class="header-section-number">17.5</span> Supported by</h2>
352
+ <div class="quarto-figure quarto-figure-center">
353
+ <figure class="figure">
354
+ <p><a href="https://www.starcore.co"><img src="new_starcore_logo.png" class="img-fluid figure-img"></a></p>
355
+ <figcaption class="figure-caption">StarCore Analytics</figcaption>
356
+ </figure>
357
+ </div>
358
+
359
+
360
+ </section>
361
+
362
+ </main> <!-- /main -->
363
+ <script id="quarto-html-after-body" type="application/javascript">
364
+ window.document.addEventListener("DOMContentLoaded", function (event) {
365
+ const toggleBodyColorMode = (bsSheetEl) => {
366
+ const mode = bsSheetEl.getAttribute("data-mode");
367
+ const bodyEl = window.document.querySelector("body");
368
+ if (mode === "dark") {
369
+ bodyEl.classList.add("quarto-dark");
370
+ bodyEl.classList.remove("quarto-light");
371
+ } else {
372
+ bodyEl.classList.add("quarto-light");
373
+ bodyEl.classList.remove("quarto-dark");
374
+ }
375
+ }
376
+ const toggleBodyColorPrimary = () => {
377
+ const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
378
+ if (bsSheetEl) {
379
+ toggleBodyColorMode(bsSheetEl);
380
+ }
381
+ }
382
+ toggleBodyColorPrimary();
383
+ const icon = "";
384
+ const anchorJS = new window.AnchorJS();
385
+ anchorJS.options = {
386
+ placement: 'right',
387
+ icon: icon
388
+ };
389
+ anchorJS.add('.anchored');
390
+ const isCodeAnnotation = (el) => {
391
+ for (const clz of el.classList) {
392
+ if (clz.startsWith('code-annotation-')) {
393
+ return true;
394
+ }
395
+ }
396
+ return false;
397
+ }
398
+ const clipboard = new window.ClipboardJS('.code-copy-button', {
399
+ text: function(trigger) {
400
+ const codeEl = trigger.previousElementSibling.cloneNode(true);
401
+ for (const childEl of codeEl.children) {
402
+ if (isCodeAnnotation(childEl)) {
403
+ childEl.remove();
404
+ }
405
+ }
406
+ return codeEl.innerText;
407
+ }
408
+ });
409
+ clipboard.on('success', function(e) {
410
+ // button target
411
+ const button = e.trigger;
412
+ // don't keep focus
413
+ button.blur();
414
+ // flash "checked"
415
+ button.classList.add('code-copy-button-checked');
416
+ var currentTitle = button.getAttribute("title");
417
+ button.setAttribute("title", "Copied!");
418
+ let tooltip;
419
+ if (window.bootstrap) {
420
+ button.setAttribute("data-bs-toggle", "tooltip");
421
+ button.setAttribute("data-bs-placement", "left");
422
+ button.setAttribute("data-bs-title", "Copied!");
423
+ tooltip = new bootstrap.Tooltip(button,
424
+ { trigger: "manual",
425
+ customClass: "code-copy-button-tooltip",
426
+ offset: [0, -8]});
427
+ tooltip.show();
428
+ }
429
+ setTimeout(function() {
430
+ if (tooltip) {
431
+ tooltip.hide();
432
+ button.removeAttribute("data-bs-title");
433
+ button.removeAttribute("data-bs-toggle");
434
+ button.removeAttribute("data-bs-placement");
435
+ }
436
+ button.setAttribute("title", currentTitle);
437
+ button.classList.remove('code-copy-button-checked');
438
+ }, 1000);
439
+ // clear code selection
440
+ e.clearSelection();
441
+ });
442
+ function tippyHover(el, contentFn) {
443
+ const config = {
444
+ allowHTML: true,
445
+ content: contentFn,
446
+ maxWidth: 500,
447
+ delay: 100,
448
+ arrow: false,
449
+ appendTo: function(el) {
450
+ return el.parentElement;
451
+ },
452
+ interactive: true,
453
+ interactiveBorder: 10,
454
+ theme: 'quarto',
455
+ placement: 'bottom-start'
456
+ };
457
+ window.tippy(el, config);
458
+ }
459
+ const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
460
+ for (var i=0; i<noterefs.length; i++) {
461
+ const ref = noterefs[i];
462
+ tippyHover(ref, function() {
463
+ // use id or data attribute instead here
464
+ let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
465
+ try { href = new URL(href).hash; } catch {}
466
+ const id = href.replace(/^#\/?/, "");
467
+ const note = window.document.getElementById(id);
468
+ return note.innerHTML;
469
+ });
470
+ }
471
+ let selectedAnnoteEl;
472
+ const selectorForAnnotation = ( cell, annotation) => {
473
+ let cellAttr = 'data-code-cell="' + cell + '"';
474
+ let lineAttr = 'data-code-annotation="' + annotation + '"';
475
+ const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
476
+ return selector;
477
+ }
478
+ const selectCodeLines = (annoteEl) => {
479
+ const doc = window.document;
480
+ const targetCell = annoteEl.getAttribute("data-target-cell");
481
+ const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
482
+ const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
483
+ const lines = annoteSpan.getAttribute("data-code-lines").split(",");
484
+ const lineIds = lines.map((line) => {
485
+ return targetCell + "-" + line;
486
+ })
487
+ let top = null;
488
+ let height = null;
489
+ let parent = null;
490
+ if (lineIds.length > 0) {
491
+ //compute the position of the single el (top and bottom and make a div)
492
+ const el = window.document.getElementById(lineIds[0]);
493
+ top = el.offsetTop;
494
+ height = el.offsetHeight;
495
+ parent = el.parentElement.parentElement;
496
+ if (lineIds.length > 1) {
497
+ const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
498
+ const bottom = lastEl.offsetTop + lastEl.offsetHeight;
499
+ height = bottom - top;
500
+ }
501
+ if (top !== null && height !== null && parent !== null) {
502
+ // cook up a div (if necessary) and position it
503
+ let div = window.document.getElementById("code-annotation-line-highlight");
504
+ if (div === null) {
505
+ div = window.document.createElement("div");
506
+ div.setAttribute("id", "code-annotation-line-highlight");
507
+ div.style.position = 'absolute';
508
+ parent.appendChild(div);
509
+ }
510
+ div.style.top = top - 2 + "px";
511
+ div.style.height = height + 4 + "px";
512
+ let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
513
+ if (gutterDiv === null) {
514
+ gutterDiv = window.document.createElement("div");
515
+ gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
516
+ gutterDiv.style.position = 'absolute';
517
+ const codeCell = window.document.getElementById(targetCell);
518
+ const gutter = codeCell.querySelector('.code-annotation-gutter');
519
+ gutter.appendChild(gutterDiv);
520
+ }
521
+ gutterDiv.style.top = top - 2 + "px";
522
+ gutterDiv.style.height = height + 4 + "px";
523
+ }
524
+ selectedAnnoteEl = annoteEl;
525
+ }
526
+ };
527
+ const unselectCodeLines = () => {
528
+ const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
529
+ elementsIds.forEach((elId) => {
530
+ const div = window.document.getElementById(elId);
531
+ if (div) {
532
+ div.remove();
533
+ }
534
+ });
535
+ selectedAnnoteEl = undefined;
536
+ };
537
+ // Attach click handler to the DT
538
+ const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
539
+ for (const annoteDlNode of annoteDls) {
540
+ annoteDlNode.addEventListener('click', (event) => {
541
+ const clickedEl = event.target;
542
+ if (clickedEl !== selectedAnnoteEl) {
543
+ unselectCodeLines();
544
+ const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
545
+ if (activeEl) {
546
+ activeEl.classList.remove('code-annotation-active');
547
+ }
548
+ selectCodeLines(clickedEl);
549
+ clickedEl.classList.add('code-annotation-active');
550
+ } else {
551
+ // Unselect the line
552
+ unselectCodeLines();
553
+ clickedEl.classList.remove('code-annotation-active');
554
+ }
555
+ });
556
+ }
557
+ const findCites = (el) => {
558
+ const parentEl = el.parentElement;
559
+ if (parentEl) {
560
+ const cites = parentEl.dataset.cites;
561
+ if (cites) {
562
+ return {
563
+ el,
564
+ cites: cites.split(' ')
565
+ };
566
+ } else {
567
+ return findCites(el.parentElement)
568
+ }
569
+ } else {
570
+ return undefined;
571
+ }
572
+ };
573
+ var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
574
+ for (var i=0; i<bibliorefs.length; i++) {
575
+ const ref = bibliorefs[i];
576
+ const citeInfo = findCites(ref);
577
+ if (citeInfo) {
578
+ tippyHover(citeInfo.el, function() {
579
+ var popup = window.document.createElement('div');
580
+ citeInfo.cites.forEach(function(cite) {
581
+ var citeDiv = window.document.createElement('div');
582
+ citeDiv.classList.add('hanging-indent');
583
+ citeDiv.classList.add('csl-entry');
584
+ var biblioDiv = window.document.getElementById('ref-' + cite);
585
+ if (biblioDiv) {
586
+ citeDiv.innerHTML = biblioDiv.innerHTML;
587
+ }
588
+ popup.appendChild(citeDiv);
589
+ });
590
+ return popup.innerHTML;
591
+ });
592
+ }
593
+ }
594
+ });
595
+ </script>
596
+ <nav class="page-navigation">
597
+ <div class="nav-page nav-page-previous">
598
+ <a href="./cw016findSmallestInt.html" class="pagination-link">
599
+ <i class="bi bi-arrow-left-short"></i> <span class="nav-page-text"><span class="chapter-number">16</span>&nbsp; <span class="chapter-title">Find the smallest integer in the array</span></span>
600
+ </a>
601
+ </div>
602
+ <div class="nav-page nav-page-next">
603
+ </div>
604
+ </nav>
605
+ </div> <!-- /content -->
606
+
607
+
608
+
609
+ </body></html>
001-reducegrow.html β†’ cw018string_to_number.html RENAMED
@@ -7,7 +7,7 @@
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
8
 
9
 
10
- <title>Codewars Challenge 2024 Menggunakan R dan RStudio - 1&nbsp; Beginner - Reduce but Grow</title>
11
  <style>
12
  code{white-space: pre-wrap;}
13
  span.smallcaps{font-variant: small-caps;}
@@ -64,8 +64,8 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
64
  <script src="site_libs/quarto-search/fuse.min.js"></script>
65
  <script src="site_libs/quarto-search/quarto-search.js"></script>
66
  <meta name="quarto:offset" content="./">
67
- <link href="./references.html" rel="next">
68
- <link href="./index.html" rel="prev">
69
  <script src="site_libs/quarto-html/quarto.js"></script>
70
  <script src="site_libs/quarto-html/popper.min.js"></script>
71
  <script src="site_libs/quarto-html/tippy.umd.min.js"></script>
@@ -75,6 +75,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
75
  <script src="site_libs/bootstrap/bootstrap.min.js"></script>
76
  <link href="site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
77
  <link href="site_libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
 
78
  <script id="quarto-search-options" type="application/json">{
79
  "location": "sidebar",
80
  "copy-button": false,
@@ -97,6 +98,12 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
97
  }</script>
98
 
99
 
 
 
 
 
 
 
100
  </head>
101
 
102
  <body class="nav-sidebar floating">
@@ -108,7 +115,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
108
  <button type="button" class="quarto-btn-toggle btn" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
109
  <i class="bi bi-layout-text-sidebar-reverse"></i>
110
  </button>
111
- <nav class="quarto-page-breadcrumbs" aria-label="breadcrumb"><ol class="breadcrumb"><li class="breadcrumb-item"><a href="./001-reducegrow.html"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Beginner - Reduce but Grow</span></a></li></ol></nav>
112
  <a class="flex-grow-1" role="button" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
113
  </a>
114
  <button type="button" class="btn quarto-search-button" aria-label="" onclick="window.quartoOpenSearch();">
@@ -124,6 +131,9 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
124
  <div class="pt-lg-2 mt-2 text-left sidebar-header">
125
  <div class="sidebar-title mb-0 py-0">
126
  <a href="./">Codewars Challenge 2024 Menggunakan R dan RStudio</a>
 
 
 
127
  </div>
128
  </div>
129
  <div class="mt-2 flex-shrink-0 align-items-center">
@@ -139,18 +149,125 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
139
  <span class="menu-text">Pengantar</span></a>
140
  </div>
141
  </li>
142
- <li class="sidebar-item">
 
 
 
 
 
 
 
 
 
143
  <div class="sidebar-item-container">
144
- <a href="./001-reducegrow.html" class="sidebar-item-text sidebar-link active">
145
- <span class="menu-text"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Beginner - Reduce but Grow</span></span></a>
146
  </div>
147
  </li>
148
- <li class="sidebar-item">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  <div class="sidebar-item-container">
150
- <a href="./references.html" class="sidebar-item-text sidebar-link">
151
- <span class="menu-text">References</span></a>
152
  </div>
153
  </li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  </ul>
155
  </div>
156
  </nav>
@@ -161,10 +278,11 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
161
  <h2 id="toc-title">Table of contents</h2>
162
 
163
  <ul>
164
- <li><a href="#youtube-video" id="toc-youtube-video" class="nav-link active" data-scroll-target="#youtube-video"><span class="header-section-number">1.1</span> YouTube Video</a></li>
165
- <li><a href="#solution-code" id="toc-solution-code" class="nav-link" data-scroll-target="#solution-code"><span class="header-section-number">1.2</span> Solution Code</a></li>
166
- <li><a href="#test" id="toc-test" class="nav-link" data-scroll-target="#test"><span class="header-section-number">1.3</span> Test</a></li>
167
- <li><a href="#supported-by" id="toc-supported-by" class="nav-link" data-scroll-target="#supported-by"><span class="header-section-number">1.4</span> Supported by</a></li>
 
168
  </ul>
169
  </nav>
170
  </div>
@@ -173,7 +291,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
173
 
174
  <header id="title-block-header" class="quarto-title-block default">
175
  <div class="quarto-title">
176
- <h1 class="title"><span id="reducegrow" class="quarto-section-identifier"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Beginner - Reduce but Grow</span></span></h1>
177
  </div>
178
 
179
 
@@ -188,47 +306,54 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
188
 
189
  </header>
190
 
191
- <p><a href="https://www.codewars.com/kata/57f780909f7e8e3183000078/train/r" class="uri">https://www.codewars.com/kata/57f780909f7e8e3183000078/train/r</a></p>
192
- <p>Given a non-empty array of integers, return the result of multiplying the values together in order. Example:</p>
193
- <pre><code>[1, 2, 3, 4] =&gt; 1 * 2 * 3 * 4 = 24</code></pre>
194
- <section id="youtube-video" class="level2" data-number="1.1">
195
- <h2 data-number="1.1" class="anchored" data-anchor-id="youtube-video"><span class="header-section-number">1.1</span> YouTube Video</h2>
196
- <div class="quarto-video ratio ratio-16x9"><iframe data-external="1" src="https://www.youtube.com/embed/xCvHwR52p4k?si=yoLfpHfcIBYk0j9c" title="" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe></div>
 
 
 
 
 
 
 
 
 
 
 
 
197
  </section>
198
- <section id="solution-code" class="level2" data-number="1.2">
199
- <h2 data-number="1.2" class="anchored" data-anchor-id="solution-code"><span class="header-section-number">1.2</span> Solution Code</h2>
200
- <p>Solusi bar-bar</p>
201
  <div class="cell">
202
- <div class="sourceCode cell-code" id="cb2"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>grow <span class="ot">&lt;-</span> <span class="cf">function</span>(arr) {</span>
203
- <span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> result <span class="ot">&lt;-</span> <span class="dv">1</span></span>
204
- <span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span>(i <span class="cf">in</span> arr){</span>
205
- <span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a> result <span class="ot">&lt;-</span> result <span class="sc">*</span> i</span>
206
- <span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a> }</span>
207
- <span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">return</span>(result)</span>
208
- <span id="cb2-7"><a href="#cb2-7" aria-hidden="true" tabindex="-1"></a>}</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
209
  </div>
210
- <p>Solusi simple</p>
211
  <div class="cell">
212
- <div class="sourceCode cell-code" id="cb3"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="co"># grow &lt;- function(arr) prod(arr)</span></span>
213
- <span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a>grow <span class="ot">&lt;-</span> prod</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
214
  </div>
215
  </section>
216
- <section id="test" class="level2" data-number="1.3">
217
- <h2 data-number="1.3" class="anchored" data-anchor-id="test"><span class="header-section-number">1.3</span> Test</h2>
218
  <div class="cell">
219
  <div class="sourceCode cell-code" id="cb4"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(testthat)</span>
220
- <span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="fu">test_that</span>(<span class="st">"basic tests"</span>, {</span>
221
- <span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">grow</span>(<span class="fu">c</span>(<span class="dv">1</span>, <span class="dv">2</span>, <span class="dv">3</span>)), <span class="dv">6</span>)</span>
222
- <span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">grow</span>(<span class="fu">c</span>(<span class="dv">4</span>, <span class="dv">1</span>, <span class="dv">1</span>, <span class="dv">1</span>, <span class="dv">4</span>)), <span class="dv">16</span>)</span>
223
- <span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">grow</span>(<span class="fu">c</span>(<span class="dv">2</span>, <span class="dv">2</span>, <span class="dv">2</span>, <span class="dv">2</span>, <span class="dv">2</span>, <span class="dv">2</span>)), <span class="dv">64</span>)</span>
224
- <span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
 
 
225
  <div class="cell-output cell-output-stdout">
226
- <pre><code>Test passed πŸ₯‡</code></pre>
227
  </div>
228
  </div>
229
  </section>
230
- <section id="supported-by" class="level2" data-number="1.4">
231
- <h2 data-number="1.4" class="anchored" data-anchor-id="supported-by"><span class="header-section-number">1.4</span> Supported by</h2>
232
  <div class="quarto-figure quarto-figure-center">
233
  <figure class="figure">
234
  <p><a href="https://www.starcore.co"><img src="new_starcore_logo.png" class="img-fluid figure-img"></a></p>
@@ -475,14 +600,11 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
475
  </script>
476
  <nav class="page-navigation">
477
  <div class="nav-page nav-page-previous">
478
- <a href="./index.html" class="pagination-link">
479
- <i class="bi bi-arrow-left-short"></i> <span class="nav-page-text">Pengantar</span>
480
  </a>
481
  </div>
482
  <div class="nav-page nav-page-next">
483
- <a href="./references.html" class="pagination-link">
484
- <span class="nav-page-text">References</span> <i class="bi bi-arrow-right-short"></i>
485
- </a>
486
  </div>
487
  </nav>
488
  </div> <!-- /content -->
 
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
8
 
9
 
10
+ <title>Codewars Challenge 2024 Menggunakan R dan RStudio - 18&nbsp; onvert a String to a Number!</title>
11
  <style>
12
  code{white-space: pre-wrap;}
13
  span.smallcaps{font-variant: small-caps;}
 
64
  <script src="site_libs/quarto-search/fuse.min.js"></script>
65
  <script src="site_libs/quarto-search/quarto-search.js"></script>
66
  <meta name="quarto:offset" content="./">
67
+ <link href="./cw017basic_op.html" rel="prev">
68
+ <link href="./logo.png" rel="icon" type="image/png">
69
  <script src="site_libs/quarto-html/quarto.js"></script>
70
  <script src="site_libs/quarto-html/popper.min.js"></script>
71
  <script src="site_libs/quarto-html/tippy.umd.min.js"></script>
 
75
  <script src="site_libs/bootstrap/bootstrap.min.js"></script>
76
  <link href="site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
77
  <link href="site_libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
78
+ <link href="site_libs/quarto-contrib/badge/badge.css" rel="stylesheet">
79
  <script id="quarto-search-options" type="application/json">{
80
  "location": "sidebar",
81
  "copy-button": false,
 
98
  }</script>
99
 
100
 
101
+ <meta name="twitter:title" content="Codewars Challenge 2024 Menggunakan R dan RStudio - 18&nbsp; onvert a String to a Number!">
102
+ <meta name="twitter:description" content="">
103
+ <meta name="twitter:image" content="https://huggingface.co/spaces/aephidayatuloh/codewars2024/new_starcore_logo.png">
104
+ <meta name="twitter:image-height" content="434">
105
+ <meta name="twitter:image-width" content="1946">
106
+ <meta name="twitter:card" content="summary_large_image">
107
  </head>
108
 
109
  <body class="nav-sidebar floating">
 
115
  <button type="button" class="quarto-btn-toggle btn" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
116
  <i class="bi bi-layout-text-sidebar-reverse"></i>
117
  </button>
118
+ <nav class="quarto-page-breadcrumbs" aria-label="breadcrumb"><ol class="breadcrumb"><li class="breadcrumb-item"><a href="./cw001evenodd.html">Februari</a></li><li class="breadcrumb-item"><a href="./cw018string_to_number.html"><span class="chapter-number">18</span>&nbsp; <span class="chapter-title">onvert a String to a Number!</span></a></li></ol></nav>
119
  <a class="flex-grow-1" role="button" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
120
  </a>
121
  <button type="button" class="btn quarto-search-button" aria-label="" onclick="window.quartoOpenSearch();">
 
131
  <div class="pt-lg-2 mt-2 text-left sidebar-header">
132
  <div class="sidebar-title mb-0 py-0">
133
  <a href="./">Codewars Challenge 2024 Menggunakan R dan RStudio</a>
134
+ <div class="sidebar-tools-main">
135
+ <a href="https://huggingface.co/spaces/aephidayatuloh/codewars2024/tree/main" rel="" title="Source Code" class="quarto-navigation-tool px-1" aria-label="Source Code"><i class="bi bi-git"></i></a>
136
+ </div>
137
  </div>
138
  </div>
139
  <div class="mt-2 flex-shrink-0 align-items-center">
 
149
  <span class="menu-text">Pengantar</span></a>
150
  </div>
151
  </li>
152
+ <li class="sidebar-item sidebar-item-section">
153
+ <div class="sidebar-item-container">
154
+ <a class="sidebar-item-text sidebar-link text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" aria-expanded="true">
155
+ <span class="menu-text">Februari</span></a>
156
+ <a class="sidebar-item-toggle text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" aria-expanded="true" aria-label="Toggle section">
157
+ <i class="bi bi-chevron-right ms-2"></i>
158
+ </a>
159
+ </div>
160
+ <ul id="quarto-sidebar-section-1" class="collapse list-unstyled sidebar-section depth1 show">
161
+ <li class="sidebar-item">
162
  <div class="sidebar-item-container">
163
+ <a href="./cw001evenodd.html" class="sidebar-item-text sidebar-link">
164
+ <span class="menu-text"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Even or Odd</span></span></a>
165
  </div>
166
  </li>
167
+ <li class="sidebar-item">
168
+ <div class="sidebar-item-container">
169
+ <a href="./cw002multiply.html" class="sidebar-item-text sidebar-link">
170
+ <span class="menu-text"><span class="chapter-number">2</span>&nbsp; <span class="chapter-title">Multiply</span></span></a>
171
+ </div>
172
+ </li>
173
+ <li class="sidebar-item">
174
+ <div class="sidebar-item-container">
175
+ <a href="./cw003countsheep.html" class="sidebar-item-text sidebar-link">
176
+ <span class="menu-text"><span class="chapter-number">3</span>&nbsp; <span class="chapter-title">If you can’t sleep, just count sheep!!</span></span></a>
177
+ </div>
178
+ </li>
179
+ <li class="sidebar-item">
180
+ <div class="sidebar-item-container">
181
+ <a href="./cw004reducegrow.html" class="sidebar-item-text sidebar-link">
182
+ <span class="menu-text"><span class="chapter-number">4</span>&nbsp; <span class="chapter-title">Beginner - Reduce but Grow</span></span></a>
183
+ </div>
184
+ </li>
185
+ <li class="sidebar-item">
186
+ <div class="sidebar-item-container">
187
+ <a href="./cw005make_negative.html" class="sidebar-item-text sidebar-link">
188
+ <span class="menu-text"><span class="chapter-number">5</span>&nbsp; <span class="chapter-title">Return Negative</span></span></a>
189
+ </div>
190
+ </li>
191
+ <li class="sidebar-item">
192
+ <div class="sidebar-item-container">
193
+ <a href="./cw006positive_sum.html" class="sidebar-item-text sidebar-link">
194
+ <span class="menu-text"><span class="chapter-number">6</span>&nbsp; <span class="chapter-title">Sum of positive</span></span></a>
195
+ </div>
196
+ </li>
197
+ <li class="sidebar-item">
198
+ <div class="sidebar-item-container">
199
+ <a href="./cw007reversedstrings.html" class="sidebar-item-text sidebar-link">
200
+ <span class="menu-text"><span class="chapter-number">7</span>&nbsp; <span class="chapter-title">Reversed Strings</span></span></a>
201
+ </div>
202
+ </li>
203
+ <li class="sidebar-item">
204
+ <div class="sidebar-item-container">
205
+ <a href="./cw008bool_to_word.html" class="sidebar-item-text sidebar-link">
206
+ <span class="menu-text"><span class="chapter-number">8</span>&nbsp; <span class="chapter-title">Convert boolean values to strings β€˜Yes’ or β€˜No’</span></span></a>
207
+ </div>
208
+ </li>
209
+ <li class="sidebar-item">
210
+ <div class="sidebar-item-container">
211
+ <a href="./cw009number_to_string.html" class="sidebar-item-text sidebar-link">
212
+ <span class="menu-text"><span class="chapter-number">9</span>&nbsp; <span class="chapter-title">Convert a Number to a String!</span></span></a>
213
+ </div>
214
+ </li>
215
+ <li class="sidebar-item">
216
  <div class="sidebar-item-container">
217
+ <a href="./cw010opposite.html" class="sidebar-item-text sidebar-link">
218
+ <span class="menu-text"><span class="chapter-number">10</span>&nbsp; <span class="chapter-title">Opposite number</span></span></a>
219
  </div>
220
  </li>
221
+ <li class="sidebar-item">
222
+ <div class="sidebar-item-container">
223
+ <a href="./cw011removeChar.html" class="sidebar-item-text sidebar-link">
224
+ <span class="menu-text"><span class="chapter-number">11</span>&nbsp; <span class="chapter-title">Remove First and Last Character</span></span></a>
225
+ </div>
226
+ </li>
227
+ <li class="sidebar-item">
228
+ <div class="sidebar-item-container">
229
+ <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
230
+ <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
231
+ </div>
232
+ </li>
233
+ <li class="sidebar-item">
234
+ <div class="sidebar-item-container">
235
+ <a href="./cw013repeat_string.html" class="sidebar-item-text sidebar-link">
236
+ <span class="menu-text"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">String repeat</span></span></a>
237
+ </div>
238
+ </li>
239
+ <li class="sidebar-item">
240
+ <div class="sidebar-item-container">
241
+ <a href="./cw014summation.html" class="sidebar-item-text sidebar-link">
242
+ <span class="menu-text"><span class="chapter-number">14</span>&nbsp; <span class="chapter-title">Grasshopper - Summation</span></span></a>
243
+ </div>
244
+ </li>
245
+ <li class="sidebar-item">
246
+ <div class="sidebar-item-container">
247
+ <a href="./cw015no_spaces.html" class="sidebar-item-text sidebar-link">
248
+ <span class="menu-text"><span class="chapter-number">15</span>&nbsp; <span class="chapter-title">Remove String Spaces</span></span></a>
249
+ </div>
250
+ </li>
251
+ <li class="sidebar-item">
252
+ <div class="sidebar-item-container">
253
+ <a href="./cw016findSmallestInt.html" class="sidebar-item-text sidebar-link">
254
+ <span class="menu-text"><span class="chapter-number">16</span>&nbsp; <span class="chapter-title">Find the smallest integer in the array</span></span></a>
255
+ </div>
256
+ </li>
257
+ <li class="sidebar-item">
258
+ <div class="sidebar-item-container">
259
+ <a href="./cw017basic_op.html" class="sidebar-item-text sidebar-link">
260
+ <span class="menu-text"><span class="chapter-number">17</span>&nbsp; <span class="chapter-title">Basic Mathematical Operations</span></span></a>
261
+ </div>
262
+ </li>
263
+ <li class="sidebar-item">
264
+ <div class="sidebar-item-container">
265
+ <a href="./cw018string_to_number.html" class="sidebar-item-text sidebar-link active">
266
+ <span class="menu-text"><span class="chapter-number">18</span>&nbsp; <span class="chapter-title">onvert a String to a Number!</span></span></a>
267
+ </div>
268
+ </li>
269
+ </ul>
270
+ </li>
271
  </ul>
272
  </div>
273
  </nav>
 
278
  <h2 id="toc-title">Table of contents</h2>
279
 
280
  <ul>
281
+ <li><a href="#instruction" id="toc-instruction" class="nav-link active" data-scroll-target="#instruction"><span class="header-section-number">18.1</span> Instruction</a></li>
282
+ <li><a href="#youtube-video" id="toc-youtube-video" class="nav-link" data-scroll-target="#youtube-video"><span class="header-section-number">18.2</span> YouTube Video</a></li>
283
+ <li><a href="#solution-code" id="toc-solution-code" class="nav-link" data-scroll-target="#solution-code"><span class="header-section-number">18.3</span> Solution Code</a></li>
284
+ <li><a href="#test" id="toc-test" class="nav-link" data-scroll-target="#test"><span class="header-section-number">18.4</span> Test</a></li>
285
+ <li><a href="#supported-by" id="toc-supported-by" class="nav-link" data-scroll-target="#supported-by"><span class="header-section-number">18.5</span> Supported by</a></li>
286
  </ul>
287
  </nav>
288
  </div>
 
291
 
292
  <header id="title-block-header" class="quarto-title-block default">
293
  <div class="quarto-title">
294
+ <h1 class="title"><span class="chapter-number">18</span>&nbsp; <span class="chapter-title">onvert a String to a Number!</span></h1>
295
  </div>
296
 
297
 
 
306
 
307
  </header>
308
 
309
+ <p><span class="badge rounded-pill quarto-badge " style="background-color: grey;">8kyu</span> Tantangan #18/366 - 03 Mar 2024</p>
310
+ <p><a href="https://www.codewars.com/kata/57356c55867b9b7a60000bd7" class="uri">https://www.codewars.com/kata/57356c55867b9b7a60000bd7</a></p>
311
+ <section id="instruction" class="level2" data-number="18.1">
312
+ <h2 data-number="18.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">18.1</span> Instruction</h2>
313
+ <p>Note: This kata is inspired by Convert a Number to a String!. Try that one too.</p>
314
+ <p>Description We need a function that can transform a string into a number. What ways of achieving this do you know?</p>
315
+ <p>Note: Don’t worry, all inputs will be strings, and every string is a perfectly valid representation of an integral number.</p>
316
+ <p><strong>Examples</strong></p>
317
+ <div class="cell">
318
+ <div class="sourceCode cell-code" id="cb1"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="st">"1234"</span> <span class="sc">-</span><span class="ot">-&gt;</span> <span class="dv">1234</span></span>
319
+ <span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="st">"605"</span> <span class="sc">-</span><span class="ot">-&gt;</span> <span class="dv">605</span></span>
320
+ <span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="st">"1405"</span> <span class="sc">-</span><span class="ot">-&gt;</span> <span class="dv">1405</span></span>
321
+ <span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a><span class="st">"-7"</span> <span class="sc">-</span><span class="ot">-&gt;</span> <span class="sc">-</span><span class="dv">7</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
322
+ </div>
323
+ </section>
324
+ <section id="youtube-video" class="level2" data-number="18.2">
325
+ <h2 data-number="18.2" class="anchored" data-anchor-id="youtube-video"><span class="header-section-number">18.2</span> YouTube Video</h2>
326
+ <div class="quarto-video ratio ratio-16x9"><iframe data-external="1" src="https://www.youtube.com/embed/L8aczEhqymk?si=DSx84acpNvbkucrK" title="" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe></div>
327
  </section>
328
+ <section id="solution-code" class="level2" data-number="18.3">
329
+ <h2 data-number="18.3" class="anchored" data-anchor-id="solution-code"><span class="header-section-number">18.3</span> Solution Code</h2>
 
330
  <div class="cell">
331
+ <div class="sourceCode cell-code" id="cb2"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>string_to_number <span class="ot">&lt;-</span> <span class="cf">function</span>(x){</span>
332
+ <span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">as.numeric</span>(x)</span>
333
+ <span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a>}</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
 
 
 
 
334
  </div>
 
335
  <div class="cell">
336
+ <div class="sourceCode cell-code" id="cb3"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a>string_to_number <span class="ot">&lt;-</span> as.numeric</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
 
337
  </div>
338
  </section>
339
+ <section id="test" class="level2" data-number="18.4">
340
+ <h2 data-number="18.4" class="anchored" data-anchor-id="test"><span class="header-section-number">18.4</span> Test</h2>
341
  <div class="cell">
342
  <div class="sourceCode cell-code" id="cb4"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(testthat)</span>
343
+ <span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a></span>
344
+ <span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="fu">test_that</span>(<span class="st">'Basic tests'</span>, {</span>
345
+ <span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">string_to_number</span>(<span class="st">"1234"</span>), <span class="dv">1234</span>)</span>
346
+ <span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">string_to_number</span>(<span class="st">"605"</span>), <span class="dv">605</span>)</span>
347
+ <span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">string_to_number</span>(<span class="st">"1405"</span>), <span class="dv">1405</span>)</span>
348
+ <span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">expect_equal</span>(<span class="fu">string_to_number</span>(<span class="st">"-7"</span>), <span class="sc">-</span><span class="dv">7</span>)</span>
349
+ <span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a>})</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
350
  <div class="cell-output cell-output-stdout">
351
+ <pre><code>Test passed 😸</code></pre>
352
  </div>
353
  </div>
354
  </section>
355
+ <section id="supported-by" class="level2" data-number="18.5">
356
+ <h2 data-number="18.5" class="anchored" data-anchor-id="supported-by"><span class="header-section-number">18.5</span> Supported by</h2>
357
  <div class="quarto-figure quarto-figure-center">
358
  <figure class="figure">
359
  <p><a href="https://www.starcore.co"><img src="new_starcore_logo.png" class="img-fluid figure-img"></a></p>
 
600
  </script>
601
  <nav class="page-navigation">
602
  <div class="nav-page nav-page-previous">
603
+ <a href="./cw017basic_op.html" class="pagination-link">
604
+ <i class="bi bi-arrow-left-short"></i> <span class="nav-page-text"><span class="chapter-number">17</span>&nbsp; <span class="chapter-title">Basic Mathematical Operations</span></span>
605
  </a>
606
  </div>
607
  <div class="nav-page nav-page-next">
 
 
 
608
  </div>
609
  </nav>
610
  </div> <!-- /content -->
index.html CHANGED
@@ -195,6 +195,42 @@ ul.task-list li input[type="checkbox"] {
195
  <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
196
  <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
197
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  </li>
199
  </ul>
200
  </li>
@@ -237,7 +273,7 @@ ul.task-list li input[type="checkbox"] {
237
  <div>
238
  <div class="quarto-title-meta-heading">Published</div>
239
  <div class="quarto-title-meta-contents">
240
- <p class="date">Last Updated on 07 February, 2024</p>
241
  </div>
242
  </div>
243
 
 
195
  <a href="./cw012square_sum.html" class="sidebar-item-text sidebar-link">
196
  <span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Square(n) Sum</span></span></a>
197
  </div>
198
+ </li>
199
+ <li class="sidebar-item">
200
+ <div class="sidebar-item-container">
201
+ <a href="./cw013repeat_string.html" class="sidebar-item-text sidebar-link">
202
+ <span class="menu-text"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">String repeat</span></span></a>
203
+ </div>
204
+ </li>
205
+ <li class="sidebar-item">
206
+ <div class="sidebar-item-container">
207
+ <a href="./cw014summation.html" class="sidebar-item-text sidebar-link">
208
+ <span class="menu-text"><span class="chapter-number">14</span>&nbsp; <span class="chapter-title">Grasshopper - Summation</span></span></a>
209
+ </div>
210
+ </li>
211
+ <li class="sidebar-item">
212
+ <div class="sidebar-item-container">
213
+ <a href="./cw015no_spaces.html" class="sidebar-item-text sidebar-link">
214
+ <span class="menu-text"><span class="chapter-number">15</span>&nbsp; <span class="chapter-title">Remove String Spaces</span></span></a>
215
+ </div>
216
+ </li>
217
+ <li class="sidebar-item">
218
+ <div class="sidebar-item-container">
219
+ <a href="./cw016findSmallestInt.html" class="sidebar-item-text sidebar-link">
220
+ <span class="menu-text"><span class="chapter-number">16</span>&nbsp; <span class="chapter-title">Find the smallest integer in the array</span></span></a>
221
+ </div>
222
+ </li>
223
+ <li class="sidebar-item">
224
+ <div class="sidebar-item-container">
225
+ <a href="./cw017basic_op.html" class="sidebar-item-text sidebar-link">
226
+ <span class="menu-text"><span class="chapter-number">17</span>&nbsp; <span class="chapter-title">Basic Mathematical Operations</span></span></a>
227
+ </div>
228
+ </li>
229
+ <li class="sidebar-item">
230
+ <div class="sidebar-item-container">
231
+ <a href="./cw018string_to_number.html" class="sidebar-item-text sidebar-link">
232
+ <span class="menu-text"><span class="chapter-number">18</span>&nbsp; <span class="chapter-title">onvert a String to a Number!</span></span></a>
233
+ </div>
234
  </li>
235
  </ul>
236
  </li>
 
273
  <div>
274
  <div class="quarto-title-meta-heading">Published</div>
275
  <div class="quarto-title-meta-contents">
276
+ <p class="date">Last Updated on 21 February, 2024</p>
277
  </div>
278
  </div>
279