aepstar commited on
Commit
13d6087
·
1 Parent(s): 87b7a02

update book

Browse files
Files changed (7) hide show
  1. _quarto.yml +4 -1
  2. countsheep.html +492 -0
  3. evenodd.html +533 -0
  4. index.html +23 -5
  5. multiply.html +488 -0
  6. reducegrow.html +510 -0
  7. references.html +23 -5
_quarto.yml CHANGED
@@ -8,7 +8,10 @@ book:
8
  date-format: "[Last Updated on ] DD MMMM, YYYY"
9
  chapters:
10
  - index.qmd
11
- - 001-reducegrow.qmd
 
 
 
12
  - references.qmd
13
 
14
  bibliography: references.bib
 
8
  date-format: "[Last Updated on ] DD MMMM, YYYY"
9
  chapters:
10
  - index.qmd
11
+ - evenodd.qmd
12
+ - multiply.qmd
13
+ - countsheep.qmd
14
+ - reducegrow.qmd
15
  - references.qmd
16
 
17
  bibliography: references.bib
countsheep.html ADDED
@@ -0,0 +1,492 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 - 3&nbsp; If you can’t sleep, just count sheep!!</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="./reducegrow.html" rel="next">
68
+ <link href="./multiply.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>
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
+ <script id="quarto-search-options" type="application/json">{
79
+ "location": "sidebar",
80
+ "copy-button": false,
81
+ "collapse-after": 3,
82
+ "panel-placement": "start",
83
+ "type": "textbox",
84
+ "limit": 20,
85
+ "language": {
86
+ "search-no-results-text": "No results",
87
+ "search-matching-documents-text": "matching documents",
88
+ "search-copy-link-title": "Copy link to search",
89
+ "search-hide-matches-text": "Hide additional matches",
90
+ "search-more-match-text": "more match in this document",
91
+ "search-more-matches-text": "more matches in this document",
92
+ "search-clear-button-title": "Clear",
93
+ "search-detached-cancel-button-title": "Cancel",
94
+ "search-submit-button-title": "Submit",
95
+ "search-label": "Search"
96
+ }
97
+ }</script>
98
+
99
+
100
+ </head>
101
+
102
+ <body class="nav-sidebar floating">
103
+
104
+ <div id="quarto-search-results"></div>
105
+ <header id="quarto-header" class="headroom fixed-top">
106
+ <nav class="quarto-secondary-nav">
107
+ <div class="container-fluid d-flex">
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="./countsheep.html"><span class="chapter-number">3</span>&nbsp; <span class="chapter-title">If you can't sleep, just count sheep!!</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();">
115
+ <i class="bi bi-search"></i>
116
+ </button>
117
+ </div>
118
+ </nav>
119
+ </header>
120
+ <!-- content -->
121
+ <div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article">
122
+ <!-- sidebar -->
123
+ <nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal sidebar-navigation floating overflow-auto">
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">
130
+ <div class="sidebar-search">
131
+ <div id="quarto-search" class="" title="Search"></div>
132
+ </div>
133
+ </div>
134
+ <div class="sidebar-menu-container">
135
+ <ul class="list-unstyled mt-1">
136
+ <li class="sidebar-item">
137
+ <div class="sidebar-item-container">
138
+ <a href="./index.html" class="sidebar-item-text sidebar-link">
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="./evenodd.html" class="sidebar-item-text sidebar-link">
145
+ <span class="menu-text"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Even or Odd</span></span></a>
146
+ </div>
147
+ </li>
148
+ <li class="sidebar-item">
149
+ <div class="sidebar-item-container">
150
+ <a href="./multiply.html" class="sidebar-item-text sidebar-link">
151
+ <span class="menu-text"><span class="chapter-number">2</span>&nbsp; <span class="chapter-title">Multiply</span></span></a>
152
+ </div>
153
+ </li>
154
+ <li class="sidebar-item">
155
+ <div class="sidebar-item-container">
156
+ <a href="./countsheep.html" class="sidebar-item-text sidebar-link active">
157
+ <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>
158
+ </div>
159
+ </li>
160
+ <li class="sidebar-item">
161
+ <div class="sidebar-item-container">
162
+ <a href="./reducegrow.html" class="sidebar-item-text sidebar-link">
163
+ <span class="menu-text"><span class="chapter-number">4</span>&nbsp; <span class="chapter-title">Beginner - Reduce but Grow</span></span></a>
164
+ </div>
165
+ </li>
166
+ <li class="sidebar-item">
167
+ <div class="sidebar-item-container">
168
+ <a href="./references.html" class="sidebar-item-text sidebar-link">
169
+ <span class="menu-text">References</span></a>
170
+ </div>
171
+ </li>
172
+ </ul>
173
+ </div>
174
+ </nav>
175
+ <div id="quarto-sidebar-glass" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass"></div>
176
+ <!-- margin-sidebar -->
177
+ <div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
178
+ <nav id="TOC" role="doc-toc" class="toc-active">
179
+ <h2 id="toc-title">Table of contents</h2>
180
+
181
+ <ul>
182
+ <li><a href="#instruction" id="toc-instruction" class="nav-link active" data-scroll-target="#instruction"><span class="header-section-number">3.1</span> Instruction</a></li>
183
+ <li><a href="#youtube-video" id="toc-youtube-video" class="nav-link" data-scroll-target="#youtube-video"><span class="header-section-number">3.2</span> YouTube Video</a></li>
184
+ <li><a href="#solution-code" id="toc-solution-code" class="nav-link" data-scroll-target="#solution-code"><span class="header-section-number">3.3</span> Solution Code</a></li>
185
+ <li><a href="#test" id="toc-test" class="nav-link" data-scroll-target="#test"><span class="header-section-number">3.4</span> Test</a></li>
186
+ <li><a href="#supported-by" id="toc-supported-by" class="nav-link" data-scroll-target="#supported-by"><span class="header-section-number">3.5</span> Supported by</a></li>
187
+ </ul>
188
+ </nav>
189
+ </div>
190
+ <!-- main -->
191
+ <main class="content" id="quarto-document-content">
192
+
193
+ <header id="title-block-header" class="quarto-title-block default">
194
+ <div class="quarto-title">
195
+ <h1 class="title"><span class="chapter-number">3</span>&nbsp; <span class="chapter-title">If you can’t sleep, just count sheep!!</span></h1>
196
+ </div>
197
+
198
+
199
+
200
+ <div class="quarto-title-meta">
201
+
202
+
203
+
204
+
205
+ </div>
206
+
207
+
208
+ </header>
209
+
210
+ <p><a href="https://www.codewars.com/kata/5b077ebdaf15be5c7f000077/train/r" class="uri">https://www.codewars.com/kata/5b077ebdaf15be5c7f000077/train/r</a></p>
211
+ <section id="instruction" class="level2" data-number="3.1">
212
+ <h2 data-number="3.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">3.1</span> Instruction</h2>
213
+ <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>
214
+ </section>
215
+ <section id="youtube-video" class="level2" data-number="3.2">
216
+ <h2 data-number="3.2" class="anchored" data-anchor-id="youtube-video"><span class="header-section-number">3.2</span> YouTube Video</h2>
217
+ <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>
218
+ </section>
219
+ <section id="solution-code" class="level2" data-number="3.3">
220
+ <h2 data-number="3.3" class="anchored" data-anchor-id="solution-code"><span class="header-section-number">3.3</span> Solution Code</h2>
221
+ <p>Solusi bar-bar</p>
222
+ <p>Solusi simple</p>
223
+ </section>
224
+ <section id="test" class="level2" data-number="3.4">
225
+ <h2 data-number="3.4" class="anchored" data-anchor-id="test"><span class="header-section-number">3.4</span> Test</h2>
226
+ <div class="cell">
227
+ <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="fu">library</span>(testthat)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
228
+ </div>
229
+ </section>
230
+ <section id="supported-by" class="level2" data-number="3.5">
231
+ <h2 data-number="3.5" class="anchored" data-anchor-id="supported-by"><span class="header-section-number">3.5</span> Supported by</h2>
232
+ <p>StarCore Analytics</p>
233
+ <div class="quarto-figure quarto-figure-center">
234
+ <figure class="figure">
235
+ <p><a href="https://www.starcore.co"><img src="new_starcore_logo.png" class="img-fluid figure-img"></a></p>
236
+ </figure>
237
+ </div>
238
+
239
+
240
+ </section>
241
+
242
+ </main> <!-- /main -->
243
+ <script id="quarto-html-after-body" type="application/javascript">
244
+ window.document.addEventListener("DOMContentLoaded", function (event) {
245
+ const toggleBodyColorMode = (bsSheetEl) => {
246
+ const mode = bsSheetEl.getAttribute("data-mode");
247
+ const bodyEl = window.document.querySelector("body");
248
+ if (mode === "dark") {
249
+ bodyEl.classList.add("quarto-dark");
250
+ bodyEl.classList.remove("quarto-light");
251
+ } else {
252
+ bodyEl.classList.add("quarto-light");
253
+ bodyEl.classList.remove("quarto-dark");
254
+ }
255
+ }
256
+ const toggleBodyColorPrimary = () => {
257
+ const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
258
+ if (bsSheetEl) {
259
+ toggleBodyColorMode(bsSheetEl);
260
+ }
261
+ }
262
+ toggleBodyColorPrimary();
263
+ const icon = "";
264
+ const anchorJS = new window.AnchorJS();
265
+ anchorJS.options = {
266
+ placement: 'right',
267
+ icon: icon
268
+ };
269
+ anchorJS.add('.anchored');
270
+ const isCodeAnnotation = (el) => {
271
+ for (const clz of el.classList) {
272
+ if (clz.startsWith('code-annotation-')) {
273
+ return true;
274
+ }
275
+ }
276
+ return false;
277
+ }
278
+ const clipboard = new window.ClipboardJS('.code-copy-button', {
279
+ text: function(trigger) {
280
+ const codeEl = trigger.previousElementSibling.cloneNode(true);
281
+ for (const childEl of codeEl.children) {
282
+ if (isCodeAnnotation(childEl)) {
283
+ childEl.remove();
284
+ }
285
+ }
286
+ return codeEl.innerText;
287
+ }
288
+ });
289
+ clipboard.on('success', function(e) {
290
+ // button target
291
+ const button = e.trigger;
292
+ // don't keep focus
293
+ button.blur();
294
+ // flash "checked"
295
+ button.classList.add('code-copy-button-checked');
296
+ var currentTitle = button.getAttribute("title");
297
+ button.setAttribute("title", "Copied!");
298
+ let tooltip;
299
+ if (window.bootstrap) {
300
+ button.setAttribute("data-bs-toggle", "tooltip");
301
+ button.setAttribute("data-bs-placement", "left");
302
+ button.setAttribute("data-bs-title", "Copied!");
303
+ tooltip = new bootstrap.Tooltip(button,
304
+ { trigger: "manual",
305
+ customClass: "code-copy-button-tooltip",
306
+ offset: [0, -8]});
307
+ tooltip.show();
308
+ }
309
+ setTimeout(function() {
310
+ if (tooltip) {
311
+ tooltip.hide();
312
+ button.removeAttribute("data-bs-title");
313
+ button.removeAttribute("data-bs-toggle");
314
+ button.removeAttribute("data-bs-placement");
315
+ }
316
+ button.setAttribute("title", currentTitle);
317
+ button.classList.remove('code-copy-button-checked');
318
+ }, 1000);
319
+ // clear code selection
320
+ e.clearSelection();
321
+ });
322
+ function tippyHover(el, contentFn) {
323
+ const config = {
324
+ allowHTML: true,
325
+ content: contentFn,
326
+ maxWidth: 500,
327
+ delay: 100,
328
+ arrow: false,
329
+ appendTo: function(el) {
330
+ return el.parentElement;
331
+ },
332
+ interactive: true,
333
+ interactiveBorder: 10,
334
+ theme: 'quarto',
335
+ placement: 'bottom-start'
336
+ };
337
+ window.tippy(el, config);
338
+ }
339
+ const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
340
+ for (var i=0; i<noterefs.length; i++) {
341
+ const ref = noterefs[i];
342
+ tippyHover(ref, function() {
343
+ // use id or data attribute instead here
344
+ let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
345
+ try { href = new URL(href).hash; } catch {}
346
+ const id = href.replace(/^#\/?/, "");
347
+ const note = window.document.getElementById(id);
348
+ return note.innerHTML;
349
+ });
350
+ }
351
+ let selectedAnnoteEl;
352
+ const selectorForAnnotation = ( cell, annotation) => {
353
+ let cellAttr = 'data-code-cell="' + cell + '"';
354
+ let lineAttr = 'data-code-annotation="' + annotation + '"';
355
+ const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
356
+ return selector;
357
+ }
358
+ const selectCodeLines = (annoteEl) => {
359
+ const doc = window.document;
360
+ const targetCell = annoteEl.getAttribute("data-target-cell");
361
+ const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
362
+ const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
363
+ const lines = annoteSpan.getAttribute("data-code-lines").split(",");
364
+ const lineIds = lines.map((line) => {
365
+ return targetCell + "-" + line;
366
+ })
367
+ let top = null;
368
+ let height = null;
369
+ let parent = null;
370
+ if (lineIds.length > 0) {
371
+ //compute the position of the single el (top and bottom and make a div)
372
+ const el = window.document.getElementById(lineIds[0]);
373
+ top = el.offsetTop;
374
+ height = el.offsetHeight;
375
+ parent = el.parentElement.parentElement;
376
+ if (lineIds.length > 1) {
377
+ const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
378
+ const bottom = lastEl.offsetTop + lastEl.offsetHeight;
379
+ height = bottom - top;
380
+ }
381
+ if (top !== null && height !== null && parent !== null) {
382
+ // cook up a div (if necessary) and position it
383
+ let div = window.document.getElementById("code-annotation-line-highlight");
384
+ if (div === null) {
385
+ div = window.document.createElement("div");
386
+ div.setAttribute("id", "code-annotation-line-highlight");
387
+ div.style.position = 'absolute';
388
+ parent.appendChild(div);
389
+ }
390
+ div.style.top = top - 2 + "px";
391
+ div.style.height = height + 4 + "px";
392
+ let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
393
+ if (gutterDiv === null) {
394
+ gutterDiv = window.document.createElement("div");
395
+ gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
396
+ gutterDiv.style.position = 'absolute';
397
+ const codeCell = window.document.getElementById(targetCell);
398
+ const gutter = codeCell.querySelector('.code-annotation-gutter');
399
+ gutter.appendChild(gutterDiv);
400
+ }
401
+ gutterDiv.style.top = top - 2 + "px";
402
+ gutterDiv.style.height = height + 4 + "px";
403
+ }
404
+ selectedAnnoteEl = annoteEl;
405
+ }
406
+ };
407
+ const unselectCodeLines = () => {
408
+ const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
409
+ elementsIds.forEach((elId) => {
410
+ const div = window.document.getElementById(elId);
411
+ if (div) {
412
+ div.remove();
413
+ }
414
+ });
415
+ selectedAnnoteEl = undefined;
416
+ };
417
+ // Attach click handler to the DT
418
+ const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
419
+ for (const annoteDlNode of annoteDls) {
420
+ annoteDlNode.addEventListener('click', (event) => {
421
+ const clickedEl = event.target;
422
+ if (clickedEl !== selectedAnnoteEl) {
423
+ unselectCodeLines();
424
+ const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
425
+ if (activeEl) {
426
+ activeEl.classList.remove('code-annotation-active');
427
+ }
428
+ selectCodeLines(clickedEl);
429
+ clickedEl.classList.add('code-annotation-active');
430
+ } else {
431
+ // Unselect the line
432
+ unselectCodeLines();
433
+ clickedEl.classList.remove('code-annotation-active');
434
+ }
435
+ });
436
+ }
437
+ const findCites = (el) => {
438
+ const parentEl = el.parentElement;
439
+ if (parentEl) {
440
+ const cites = parentEl.dataset.cites;
441
+ if (cites) {
442
+ return {
443
+ el,
444
+ cites: cites.split(' ')
445
+ };
446
+ } else {
447
+ return findCites(el.parentElement)
448
+ }
449
+ } else {
450
+ return undefined;
451
+ }
452
+ };
453
+ var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
454
+ for (var i=0; i<bibliorefs.length; i++) {
455
+ const ref = bibliorefs[i];
456
+ const citeInfo = findCites(ref);
457
+ if (citeInfo) {
458
+ tippyHover(citeInfo.el, function() {
459
+ var popup = window.document.createElement('div');
460
+ citeInfo.cites.forEach(function(cite) {
461
+ var citeDiv = window.document.createElement('div');
462
+ citeDiv.classList.add('hanging-indent');
463
+ citeDiv.classList.add('csl-entry');
464
+ var biblioDiv = window.document.getElementById('ref-' + cite);
465
+ if (biblioDiv) {
466
+ citeDiv.innerHTML = biblioDiv.innerHTML;
467
+ }
468
+ popup.appendChild(citeDiv);
469
+ });
470
+ return popup.innerHTML;
471
+ });
472
+ }
473
+ }
474
+ });
475
+ </script>
476
+ <nav class="page-navigation">
477
+ <div class="nav-page nav-page-previous">
478
+ <a href="./multiply.html" class="pagination-link">
479
+ <i class="bi bi-arrow-left-short"></i> <span class="nav-page-text"><span class="chapter-number">2</span>&nbsp; <span class="chapter-title">Multiply</span></span>
480
+ </a>
481
+ </div>
482
+ <div class="nav-page nav-page-next">
483
+ <a href="./reducegrow.html" class="pagination-link">
484
+ <span class="nav-page-text"><span class="chapter-number">4</span>&nbsp; <span class="chapter-title">Beginner - Reduce but Grow</span></span> <i class="bi bi-arrow-right-short"></i>
485
+ </a>
486
+ </div>
487
+ </nav>
488
+ </div> <!-- /content -->
489
+
490
+
491
+
492
+ </body></html>
evenodd.html ADDED
@@ -0,0 +1,533 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 - 1&nbsp; Even or Odd</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="./multiply.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>
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
+ <script id="quarto-search-options" type="application/json">{
79
+ "location": "sidebar",
80
+ "copy-button": false,
81
+ "collapse-after": 3,
82
+ "panel-placement": "start",
83
+ "type": "textbox",
84
+ "limit": 20,
85
+ "language": {
86
+ "search-no-results-text": "No results",
87
+ "search-matching-documents-text": "matching documents",
88
+ "search-copy-link-title": "Copy link to search",
89
+ "search-hide-matches-text": "Hide additional matches",
90
+ "search-more-match-text": "more match in this document",
91
+ "search-more-matches-text": "more matches in this document",
92
+ "search-clear-button-title": "Clear",
93
+ "search-detached-cancel-button-title": "Cancel",
94
+ "search-submit-button-title": "Submit",
95
+ "search-label": "Search"
96
+ }
97
+ }</script>
98
+
99
+
100
+ </head>
101
+
102
+ <body class="nav-sidebar floating">
103
+
104
+ <div id="quarto-search-results"></div>
105
+ <header id="quarto-header" class="headroom fixed-top">
106
+ <nav class="quarto-secondary-nav">
107
+ <div class="container-fluid d-flex">
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="./evenodd.html"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Even or Odd</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();">
115
+ <i class="bi bi-search"></i>
116
+ </button>
117
+ </div>
118
+ </nav>
119
+ </header>
120
+ <!-- content -->
121
+ <div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article">
122
+ <!-- sidebar -->
123
+ <nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal sidebar-navigation floating overflow-auto">
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">
130
+ <div class="sidebar-search">
131
+ <div id="quarto-search" class="" title="Search"></div>
132
+ </div>
133
+ </div>
134
+ <div class="sidebar-menu-container">
135
+ <ul class="list-unstyled mt-1">
136
+ <li class="sidebar-item">
137
+ <div class="sidebar-item-container">
138
+ <a href="./index.html" class="sidebar-item-text sidebar-link">
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="./evenodd.html" class="sidebar-item-text sidebar-link active">
145
+ <span class="menu-text"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Even or Odd</span></span></a>
146
+ </div>
147
+ </li>
148
+ <li class="sidebar-item">
149
+ <div class="sidebar-item-container">
150
+ <a href="./multiply.html" class="sidebar-item-text sidebar-link">
151
+ <span class="menu-text"><span class="chapter-number">2</span>&nbsp; <span class="chapter-title">Multiply</span></span></a>
152
+ </div>
153
+ </li>
154
+ <li class="sidebar-item">
155
+ <div class="sidebar-item-container">
156
+ <a href="./countsheep.html" class="sidebar-item-text sidebar-link">
157
+ <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>
158
+ </div>
159
+ </li>
160
+ <li class="sidebar-item">
161
+ <div class="sidebar-item-container">
162
+ <a href="./reducegrow.html" class="sidebar-item-text sidebar-link">
163
+ <span class="menu-text"><span class="chapter-number">4</span>&nbsp; <span class="chapter-title">Beginner - Reduce but Grow</span></span></a>
164
+ </div>
165
+ </li>
166
+ <li class="sidebar-item">
167
+ <div class="sidebar-item-container">
168
+ <a href="./references.html" class="sidebar-item-text sidebar-link">
169
+ <span class="menu-text">References</span></a>
170
+ </div>
171
+ </li>
172
+ </ul>
173
+ </div>
174
+ </nav>
175
+ <div id="quarto-sidebar-glass" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass"></div>
176
+ <!-- margin-sidebar -->
177
+ <div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
178
+ <nav id="TOC" role="doc-toc" class="toc-active">
179
+ <h2 id="toc-title">Table of contents</h2>
180
+
181
+ <ul>
182
+ <li><a href="#instruction" id="toc-instruction" class="nav-link active" data-scroll-target="#instruction"><span class="header-section-number">1.1</span> Instruction</a></li>
183
+ <li><a href="#youtube-video" id="toc-youtube-video" class="nav-link" data-scroll-target="#youtube-video"><span class="header-section-number">1.2</span> YouTube Video</a></li>
184
+ <li><a href="#solution-code" id="toc-solution-code" class="nav-link" data-scroll-target="#solution-code"><span class="header-section-number">1.3</span> Solution Code</a></li>
185
+ <li><a href="#test" id="toc-test" class="nav-link" data-scroll-target="#test"><span class="header-section-number">1.4</span> Test</a></li>
186
+ <li><a href="#supported-by" id="toc-supported-by" class="nav-link" data-scroll-target="#supported-by"><span class="header-section-number">1.5</span> Supported by</a></li>
187
+ </ul>
188
+ </nav>
189
+ </div>
190
+ <!-- main -->
191
+ <main class="content" id="quarto-document-content">
192
+
193
+ <header id="title-block-header" class="quarto-title-block default">
194
+ <div class="quarto-title">
195
+ <h1 class="title"><span id="evenodd" class="quarto-section-identifier"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Even or Odd</span></span></h1>
196
+ </div>
197
+
198
+
199
+
200
+ <div class="quarto-title-meta">
201
+
202
+
203
+
204
+
205
+ </div>
206
+
207
+
208
+ </header>
209
+
210
+ <p><a href="https://www.codewars.com/kata/53da3dbb4a5168369a0000fe/train/r" class="uri">https://www.codewars.com/kata/53da3dbb4a5168369a0000fe/train/r</a></p>
211
+ <section id="instruction" class="level2" data-number="1.1">
212
+ <h2 data-number="1.1" class="anchored" data-anchor-id="instruction"><span class="header-section-number">1.1</span> Instruction</h2>
213
+ <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>
214
+ </section>
215
+ <section id="youtube-video" class="level2" data-number="1.2">
216
+ <h2 data-number="1.2" class="anchored" data-anchor-id="youtube-video"><span class="header-section-number">1.2</span> YouTube Video</h2>
217
+ <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>
218
+ </section>
219
+ <section id="solution-code" class="level2" data-number="1.3">
220
+ <h2 data-number="1.3" class="anchored" data-anchor-id="solution-code"><span class="header-section-number">1.3</span> Solution Code</h2>
221
+ <p>Solusi bar-bar</p>
222
+ <div class="cell">
223
+ <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>even_or_odd <span class="ot">&lt;-</span> <span class="cf">function</span>(n) {</span>
224
+ <span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">ifelse</span>(<span class="fu">abs</span>(n<span class="sc">/</span><span class="dv">2</span> <span class="sc">-</span> <span class="fu">as.integer</span>(n<span class="sc">/</span><span class="dv">2</span>)) <span class="sc">==</span> <span class="fl">0.5</span>, <span class="st">"Odd"</span>, <span class="st">"Even"</span>)</span>
225
+ <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>
226
+ </div>
227
+ <p>Solusi simple</p>
228
+ <div class="cell">
229
+ <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>even_or_odd <span class="ot">&lt;-</span> <span class="cf">function</span>(n) {</span>
230
+ <span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> <span class="co"># %% operator modulo</span></span>
231
+ <span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">ifelse</span>(n <span class="sc">%%</span> <span class="dv">2</span> <span class="sc">==</span> <span class="dv">1</span>, <span class="st">"Odd"</span>, <span class="st">"Even"</span>)</span>
232
+ <span id="cb2-4"><a href="#cb2-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>
233
+ </div>
234
+ </section>
235
+ <section id="test" class="level2" data-number="1.4">
236
+ <h2 data-number="1.4" class="anchored" data-anchor-id="test"><span class="header-section-number">1.4</span> Test</h2>
237
+ <div class="cell">
238
+ <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>
239
+ <span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="fu">test_that</span>(<span class="st">'even_or_odd(1) returns "Odd"'</span>, {</span>
240
+ <span id="cb3-3"><a href="#cb3-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>
241
+ <span id="cb3-4"><a href="#cb3-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>
242
+ <div class="cell-output cell-output-stdout">
243
+ <pre><code>Test passed 🎉</code></pre>
244
+ </div>
245
+ <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">test_that</span>(<span class="st">'even_or_odd(2) returns "Even"'</span>, {</span>
246
+ <span id="cb5-2"><a href="#cb5-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>
247
+ <span id="cb5-3"><a href="#cb5-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>
248
+ <div class="cell-output cell-output-stdout">
249
+ <pre><code>Test passed 😸</code></pre>
250
+ </div>
251
+ <div class="sourceCode cell-code" id="cb7"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="fu">test_that</span>(<span class="st">'even_or_odd(0) returns "Even"'</span>, {</span>
252
+ <span id="cb7-2"><a href="#cb7-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>
253
+ <span id="cb7-3"><a href="#cb7-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>
254
+ <div class="cell-output cell-output-stdout">
255
+ <pre><code>Test passed 😀</code></pre>
256
+ </div>
257
+ <div class="sourceCode cell-code" id="cb9"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="fu">test_that</span>(<span class="st">'even_or_odd(-1) returns "Odd"'</span>, {</span>
258
+ <span id="cb9-2"><a href="#cb9-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>
259
+ <span id="cb9-3"><a href="#cb9-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>
260
+ <div class="cell-output cell-output-stdout">
261
+ <pre><code>Test passed 😀</code></pre>
262
+ </div>
263
+ <div class="sourceCode cell-code" id="cb11"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="fu">test_that</span>(<span class="st">'even_or_odd(-2) returns "Even"'</span>, {</span>
264
+ <span id="cb11-2"><a href="#cb11-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>
265
+ <span id="cb11-3"><a href="#cb11-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>
266
+ <div class="cell-output cell-output-stdout">
267
+ <pre><code>Test passed 🎉</code></pre>
268
+ </div>
269
+ </div>
270
+ </section>
271
+ <section id="supported-by" class="level2" data-number="1.5">
272
+ <h2 data-number="1.5" class="anchored" data-anchor-id="supported-by"><span class="header-section-number">1.5</span> Supported by</h2>
273
+ <p>StarCore Analytics</p>
274
+ <div class="quarto-figure quarto-figure-center">
275
+ <figure class="figure">
276
+ <p><a href="https://www.starcore.co"><img src="new_starcore_logo.png" class="img-fluid figure-img"></a></p>
277
+ </figure>
278
+ </div>
279
+
280
+
281
+ </section>
282
+
283
+ </main> <!-- /main -->
284
+ <script id="quarto-html-after-body" type="application/javascript">
285
+ window.document.addEventListener("DOMContentLoaded", function (event) {
286
+ const toggleBodyColorMode = (bsSheetEl) => {
287
+ const mode = bsSheetEl.getAttribute("data-mode");
288
+ const bodyEl = window.document.querySelector("body");
289
+ if (mode === "dark") {
290
+ bodyEl.classList.add("quarto-dark");
291
+ bodyEl.classList.remove("quarto-light");
292
+ } else {
293
+ bodyEl.classList.add("quarto-light");
294
+ bodyEl.classList.remove("quarto-dark");
295
+ }
296
+ }
297
+ const toggleBodyColorPrimary = () => {
298
+ const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
299
+ if (bsSheetEl) {
300
+ toggleBodyColorMode(bsSheetEl);
301
+ }
302
+ }
303
+ toggleBodyColorPrimary();
304
+ const icon = "";
305
+ const anchorJS = new window.AnchorJS();
306
+ anchorJS.options = {
307
+ placement: 'right',
308
+ icon: icon
309
+ };
310
+ anchorJS.add('.anchored');
311
+ const isCodeAnnotation = (el) => {
312
+ for (const clz of el.classList) {
313
+ if (clz.startsWith('code-annotation-')) {
314
+ return true;
315
+ }
316
+ }
317
+ return false;
318
+ }
319
+ const clipboard = new window.ClipboardJS('.code-copy-button', {
320
+ text: function(trigger) {
321
+ const codeEl = trigger.previousElementSibling.cloneNode(true);
322
+ for (const childEl of codeEl.children) {
323
+ if (isCodeAnnotation(childEl)) {
324
+ childEl.remove();
325
+ }
326
+ }
327
+ return codeEl.innerText;
328
+ }
329
+ });
330
+ clipboard.on('success', function(e) {
331
+ // button target
332
+ const button = e.trigger;
333
+ // don't keep focus
334
+ button.blur();
335
+ // flash "checked"
336
+ button.classList.add('code-copy-button-checked');
337
+ var currentTitle = button.getAttribute("title");
338
+ button.setAttribute("title", "Copied!");
339
+ let tooltip;
340
+ if (window.bootstrap) {
341
+ button.setAttribute("data-bs-toggle", "tooltip");
342
+ button.setAttribute("data-bs-placement", "left");
343
+ button.setAttribute("data-bs-title", "Copied!");
344
+ tooltip = new bootstrap.Tooltip(button,
345
+ { trigger: "manual",
346
+ customClass: "code-copy-button-tooltip",
347
+ offset: [0, -8]});
348
+ tooltip.show();
349
+ }
350
+ setTimeout(function() {
351
+ if (tooltip) {
352
+ tooltip.hide();
353
+ button.removeAttribute("data-bs-title");
354
+ button.removeAttribute("data-bs-toggle");
355
+ button.removeAttribute("data-bs-placement");
356
+ }
357
+ button.setAttribute("title", currentTitle);
358
+ button.classList.remove('code-copy-button-checked');
359
+ }, 1000);
360
+ // clear code selection
361
+ e.clearSelection();
362
+ });
363
+ function tippyHover(el, contentFn) {
364
+ const config = {
365
+ allowHTML: true,
366
+ content: contentFn,
367
+ maxWidth: 500,
368
+ delay: 100,
369
+ arrow: false,
370
+ appendTo: function(el) {
371
+ return el.parentElement;
372
+ },
373
+ interactive: true,
374
+ interactiveBorder: 10,
375
+ theme: 'quarto',
376
+ placement: 'bottom-start'
377
+ };
378
+ window.tippy(el, config);
379
+ }
380
+ const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
381
+ for (var i=0; i<noterefs.length; i++) {
382
+ const ref = noterefs[i];
383
+ tippyHover(ref, function() {
384
+ // use id or data attribute instead here
385
+ let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
386
+ try { href = new URL(href).hash; } catch {}
387
+ const id = href.replace(/^#\/?/, "");
388
+ const note = window.document.getElementById(id);
389
+ return note.innerHTML;
390
+ });
391
+ }
392
+ let selectedAnnoteEl;
393
+ const selectorForAnnotation = ( cell, annotation) => {
394
+ let cellAttr = 'data-code-cell="' + cell + '"';
395
+ let lineAttr = 'data-code-annotation="' + annotation + '"';
396
+ const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
397
+ return selector;
398
+ }
399
+ const selectCodeLines = (annoteEl) => {
400
+ const doc = window.document;
401
+ const targetCell = annoteEl.getAttribute("data-target-cell");
402
+ const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
403
+ const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
404
+ const lines = annoteSpan.getAttribute("data-code-lines").split(",");
405
+ const lineIds = lines.map((line) => {
406
+ return targetCell + "-" + line;
407
+ })
408
+ let top = null;
409
+ let height = null;
410
+ let parent = null;
411
+ if (lineIds.length > 0) {
412
+ //compute the position of the single el (top and bottom and make a div)
413
+ const el = window.document.getElementById(lineIds[0]);
414
+ top = el.offsetTop;
415
+ height = el.offsetHeight;
416
+ parent = el.parentElement.parentElement;
417
+ if (lineIds.length > 1) {
418
+ const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
419
+ const bottom = lastEl.offsetTop + lastEl.offsetHeight;
420
+ height = bottom - top;
421
+ }
422
+ if (top !== null && height !== null && parent !== null) {
423
+ // cook up a div (if necessary) and position it
424
+ let div = window.document.getElementById("code-annotation-line-highlight");
425
+ if (div === null) {
426
+ div = window.document.createElement("div");
427
+ div.setAttribute("id", "code-annotation-line-highlight");
428
+ div.style.position = 'absolute';
429
+ parent.appendChild(div);
430
+ }
431
+ div.style.top = top - 2 + "px";
432
+ div.style.height = height + 4 + "px";
433
+ let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
434
+ if (gutterDiv === null) {
435
+ gutterDiv = window.document.createElement("div");
436
+ gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
437
+ gutterDiv.style.position = 'absolute';
438
+ const codeCell = window.document.getElementById(targetCell);
439
+ const gutter = codeCell.querySelector('.code-annotation-gutter');
440
+ gutter.appendChild(gutterDiv);
441
+ }
442
+ gutterDiv.style.top = top - 2 + "px";
443
+ gutterDiv.style.height = height + 4 + "px";
444
+ }
445
+ selectedAnnoteEl = annoteEl;
446
+ }
447
+ };
448
+ const unselectCodeLines = () => {
449
+ const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
450
+ elementsIds.forEach((elId) => {
451
+ const div = window.document.getElementById(elId);
452
+ if (div) {
453
+ div.remove();
454
+ }
455
+ });
456
+ selectedAnnoteEl = undefined;
457
+ };
458
+ // Attach click handler to the DT
459
+ const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
460
+ for (const annoteDlNode of annoteDls) {
461
+ annoteDlNode.addEventListener('click', (event) => {
462
+ const clickedEl = event.target;
463
+ if (clickedEl !== selectedAnnoteEl) {
464
+ unselectCodeLines();
465
+ const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
466
+ if (activeEl) {
467
+ activeEl.classList.remove('code-annotation-active');
468
+ }
469
+ selectCodeLines(clickedEl);
470
+ clickedEl.classList.add('code-annotation-active');
471
+ } else {
472
+ // Unselect the line
473
+ unselectCodeLines();
474
+ clickedEl.classList.remove('code-annotation-active');
475
+ }
476
+ });
477
+ }
478
+ const findCites = (el) => {
479
+ const parentEl = el.parentElement;
480
+ if (parentEl) {
481
+ const cites = parentEl.dataset.cites;
482
+ if (cites) {
483
+ return {
484
+ el,
485
+ cites: cites.split(' ')
486
+ };
487
+ } else {
488
+ return findCites(el.parentElement)
489
+ }
490
+ } else {
491
+ return undefined;
492
+ }
493
+ };
494
+ var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
495
+ for (var i=0; i<bibliorefs.length; i++) {
496
+ const ref = bibliorefs[i];
497
+ const citeInfo = findCites(ref);
498
+ if (citeInfo) {
499
+ tippyHover(citeInfo.el, function() {
500
+ var popup = window.document.createElement('div');
501
+ citeInfo.cites.forEach(function(cite) {
502
+ var citeDiv = window.document.createElement('div');
503
+ citeDiv.classList.add('hanging-indent');
504
+ citeDiv.classList.add('csl-entry');
505
+ var biblioDiv = window.document.getElementById('ref-' + cite);
506
+ if (biblioDiv) {
507
+ citeDiv.innerHTML = biblioDiv.innerHTML;
508
+ }
509
+ popup.appendChild(citeDiv);
510
+ });
511
+ return popup.innerHTML;
512
+ });
513
+ }
514
+ }
515
+ });
516
+ </script>
517
+ <nav class="page-navigation">
518
+ <div class="nav-page nav-page-previous">
519
+ <a href="./index.html" class="pagination-link">
520
+ <i class="bi bi-arrow-left-short"></i> <span class="nav-page-text">Pengantar</span>
521
+ </a>
522
+ </div>
523
+ <div class="nav-page nav-page-next">
524
+ <a href="./multiply.html" class="pagination-link">
525
+ <span class="nav-page-text"><span class="chapter-number">2</span>&nbsp; <span class="chapter-title">Multiply</span></span> <i class="bi bi-arrow-right-short"></i>
526
+ </a>
527
+ </div>
528
+ </nav>
529
+ </div> <!-- /content -->
530
+
531
+
532
+
533
+ </body></html>
index.html CHANGED
@@ -31,7 +31,7 @@ ul.task-list li input[type="checkbox"] {
31
  <script src="site_libs/quarto-search/fuse.min.js"></script>
32
  <script src="site_libs/quarto-search/quarto-search.js"></script>
33
  <meta name="quarto:offset" content="./">
34
- <link href="./001-reducegrow.html" rel="next">
35
  <script src="site_libs/quarto-html/quarto.js"></script>
36
  <script src="site_libs/quarto-html/popper.min.js"></script>
37
  <script src="site_libs/quarto-html/tippy.umd.min.js"></script>
@@ -107,8 +107,26 @@ ul.task-list li input[type="checkbox"] {
107
  </li>
108
  <li class="sidebar-item">
109
  <div class="sidebar-item-container">
110
- <a href="./001-reducegrow.html" class="sidebar-item-text sidebar-link">
111
- <span class="menu-text"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Beginner - Reduce but Grow</span></span></a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  </div>
113
  </li>
114
  <li class="sidebar-item">
@@ -421,8 +439,8 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
421
  <div class="nav-page nav-page-previous">
422
  </div>
423
  <div class="nav-page nav-page-next">
424
- <a href="./001-reducegrow.html" class="pagination-link">
425
- <span class="nav-page-text"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Beginner - Reduce but Grow</span></span> <i class="bi bi-arrow-right-short"></i>
426
  </a>
427
  </div>
428
  </nav>
 
31
  <script src="site_libs/quarto-search/fuse.min.js"></script>
32
  <script src="site_libs/quarto-search/quarto-search.js"></script>
33
  <meta name="quarto:offset" content="./">
34
+ <link href="./evenodd.html" rel="next">
35
  <script src="site_libs/quarto-html/quarto.js"></script>
36
  <script src="site_libs/quarto-html/popper.min.js"></script>
37
  <script src="site_libs/quarto-html/tippy.umd.min.js"></script>
 
107
  </li>
108
  <li class="sidebar-item">
109
  <div class="sidebar-item-container">
110
+ <a href="./evenodd.html" class="sidebar-item-text sidebar-link">
111
+ <span class="menu-text"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Even or Odd</span></span></a>
112
+ </div>
113
+ </li>
114
+ <li class="sidebar-item">
115
+ <div class="sidebar-item-container">
116
+ <a href="./multiply.html" class="sidebar-item-text sidebar-link">
117
+ <span class="menu-text"><span class="chapter-number">2</span>&nbsp; <span class="chapter-title">Multiply</span></span></a>
118
+ </div>
119
+ </li>
120
+ <li class="sidebar-item">
121
+ <div class="sidebar-item-container">
122
+ <a href="./countsheep.html" class="sidebar-item-text sidebar-link">
123
+ <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>
124
+ </div>
125
+ </li>
126
+ <li class="sidebar-item">
127
+ <div class="sidebar-item-container">
128
+ <a href="./reducegrow.html" class="sidebar-item-text sidebar-link">
129
+ <span class="menu-text"><span class="chapter-number">4</span>&nbsp; <span class="chapter-title">Beginner - Reduce but Grow</span></span></a>
130
  </div>
131
  </li>
132
  <li class="sidebar-item">
 
439
  <div class="nav-page nav-page-previous">
440
  </div>
441
  <div class="nav-page nav-page-next">
442
+ <a href="./evenodd.html" class="pagination-link">
443
+ <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>
444
  </a>
445
  </div>
446
  </nav>
multiply.html ADDED
@@ -0,0 +1,488 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 - 2&nbsp; Multiply</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="./countsheep.html" rel="next">
68
+ <link href="./evenodd.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>
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
+ <script id="quarto-search-options" type="application/json">{
79
+ "location": "sidebar",
80
+ "copy-button": false,
81
+ "collapse-after": 3,
82
+ "panel-placement": "start",
83
+ "type": "textbox",
84
+ "limit": 20,
85
+ "language": {
86
+ "search-no-results-text": "No results",
87
+ "search-matching-documents-text": "matching documents",
88
+ "search-copy-link-title": "Copy link to search",
89
+ "search-hide-matches-text": "Hide additional matches",
90
+ "search-more-match-text": "more match in this document",
91
+ "search-more-matches-text": "more matches in this document",
92
+ "search-clear-button-title": "Clear",
93
+ "search-detached-cancel-button-title": "Cancel",
94
+ "search-submit-button-title": "Submit",
95
+ "search-label": "Search"
96
+ }
97
+ }</script>
98
+
99
+
100
+ </head>
101
+
102
+ <body class="nav-sidebar floating">
103
+
104
+ <div id="quarto-search-results"></div>
105
+ <header id="quarto-header" class="headroom fixed-top">
106
+ <nav class="quarto-secondary-nav">
107
+ <div class="container-fluid d-flex">
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="./multiply.html"><span class="chapter-number">2</span>&nbsp; <span class="chapter-title">Multiply</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();">
115
+ <i class="bi bi-search"></i>
116
+ </button>
117
+ </div>
118
+ </nav>
119
+ </header>
120
+ <!-- content -->
121
+ <div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article">
122
+ <!-- sidebar -->
123
+ <nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal sidebar-navigation floating overflow-auto">
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">
130
+ <div class="sidebar-search">
131
+ <div id="quarto-search" class="" title="Search"></div>
132
+ </div>
133
+ </div>
134
+ <div class="sidebar-menu-container">
135
+ <ul class="list-unstyled mt-1">
136
+ <li class="sidebar-item">
137
+ <div class="sidebar-item-container">
138
+ <a href="./index.html" class="sidebar-item-text sidebar-link">
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="./evenodd.html" class="sidebar-item-text sidebar-link">
145
+ <span class="menu-text"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Even or Odd</span></span></a>
146
+ </div>
147
+ </li>
148
+ <li class="sidebar-item">
149
+ <div class="sidebar-item-container">
150
+ <a href="./multiply.html" class="sidebar-item-text sidebar-link active">
151
+ <span class="menu-text"><span class="chapter-number">2</span>&nbsp; <span class="chapter-title">Multiply</span></span></a>
152
+ </div>
153
+ </li>
154
+ <li class="sidebar-item">
155
+ <div class="sidebar-item-container">
156
+ <a href="./countsheep.html" class="sidebar-item-text sidebar-link">
157
+ <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>
158
+ </div>
159
+ </li>
160
+ <li class="sidebar-item">
161
+ <div class="sidebar-item-container">
162
+ <a href="./reducegrow.html" class="sidebar-item-text sidebar-link">
163
+ <span class="menu-text"><span class="chapter-number">4</span>&nbsp; <span class="chapter-title">Beginner - Reduce but Grow</span></span></a>
164
+ </div>
165
+ </li>
166
+ <li class="sidebar-item">
167
+ <div class="sidebar-item-container">
168
+ <a href="./references.html" class="sidebar-item-text sidebar-link">
169
+ <span class="menu-text">References</span></a>
170
+ </div>
171
+ </li>
172
+ </ul>
173
+ </div>
174
+ </nav>
175
+ <div id="quarto-sidebar-glass" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass"></div>
176
+ <!-- margin-sidebar -->
177
+ <div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
178
+ <nav id="TOC" role="doc-toc" class="toc-active">
179
+ <h2 id="toc-title">Table of contents</h2>
180
+
181
+ <ul>
182
+ <li><a href="#youtube-video" id="toc-youtube-video" class="nav-link active" data-scroll-target="#youtube-video"><span class="header-section-number">2.1</span> YouTube Video</a></li>
183
+ <li><a href="#solution-code" id="toc-solution-code" class="nav-link" data-scroll-target="#solution-code"><span class="header-section-number">2.2</span> Solution Code</a></li>
184
+ <li><a href="#test" id="toc-test" class="nav-link" data-scroll-target="#test"><span class="header-section-number">2.3</span> Test</a></li>
185
+ <li><a href="#supported-by" id="toc-supported-by" class="nav-link" data-scroll-target="#supported-by"><span class="header-section-number">2.4</span> Supported by</a></li>
186
+ </ul>
187
+ </nav>
188
+ </div>
189
+ <!-- main -->
190
+ <main class="content" id="quarto-document-content">
191
+
192
+ <header id="title-block-header" class="quarto-title-block default">
193
+ <div class="quarto-title">
194
+ <h1 class="title"><span id="multiply" class="quarto-section-identifier"><span class="chapter-number">2</span>&nbsp; <span class="chapter-title">Multiply</span></span></h1>
195
+ </div>
196
+
197
+
198
+
199
+ <div class="quarto-title-meta">
200
+
201
+
202
+
203
+
204
+ </div>
205
+
206
+
207
+ </header>
208
+
209
+ <p><a href="https://www.codewars.com/kata/50654ddff44f800200000004/train/r" class="uri">https://www.codewars.com/kata/50654ddff44f800200000004/train/r</a></p>
210
+ <p>This code does not execute properly. Try to figure out why.</p>
211
+ <section id="youtube-video" class="level2" data-number="2.1">
212
+ <h2 data-number="2.1" class="anchored" data-anchor-id="youtube-video"><span class="header-section-number">2.1</span> YouTube Video</h2>
213
+ <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>
214
+ </section>
215
+ <section id="solution-code" class="level2" data-number="2.2">
216
+ <h2 data-number="2.2" class="anchored" data-anchor-id="solution-code"><span class="header-section-number">2.2</span> Solution Code</h2>
217
+ <p>Solusi bar-bar</p>
218
+ <p>Solusi simple</p>
219
+ </section>
220
+ <section id="test" class="level2" data-number="2.3">
221
+ <h2 data-number="2.3" class="anchored" data-anchor-id="test"><span class="header-section-number">2.3</span> Test</h2>
222
+ <div class="cell">
223
+ <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="fu">library</span>(testthat)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
224
+ </div>
225
+ </section>
226
+ <section id="supported-by" class="level2" data-number="2.4">
227
+ <h2 data-number="2.4" class="anchored" data-anchor-id="supported-by"><span class="header-section-number">2.4</span> Supported by</h2>
228
+ <p>StarCore Analytics</p>
229
+ <div class="quarto-figure quarto-figure-center">
230
+ <figure class="figure">
231
+ <p><a href="https://www.starcore.co"><img src="new_starcore_logo.png" class="img-fluid figure-img"></a></p>
232
+ </figure>
233
+ </div>
234
+
235
+
236
+ </section>
237
+
238
+ </main> <!-- /main -->
239
+ <script id="quarto-html-after-body" type="application/javascript">
240
+ window.document.addEventListener("DOMContentLoaded", function (event) {
241
+ const toggleBodyColorMode = (bsSheetEl) => {
242
+ const mode = bsSheetEl.getAttribute("data-mode");
243
+ const bodyEl = window.document.querySelector("body");
244
+ if (mode === "dark") {
245
+ bodyEl.classList.add("quarto-dark");
246
+ bodyEl.classList.remove("quarto-light");
247
+ } else {
248
+ bodyEl.classList.add("quarto-light");
249
+ bodyEl.classList.remove("quarto-dark");
250
+ }
251
+ }
252
+ const toggleBodyColorPrimary = () => {
253
+ const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
254
+ if (bsSheetEl) {
255
+ toggleBodyColorMode(bsSheetEl);
256
+ }
257
+ }
258
+ toggleBodyColorPrimary();
259
+ const icon = "";
260
+ const anchorJS = new window.AnchorJS();
261
+ anchorJS.options = {
262
+ placement: 'right',
263
+ icon: icon
264
+ };
265
+ anchorJS.add('.anchored');
266
+ const isCodeAnnotation = (el) => {
267
+ for (const clz of el.classList) {
268
+ if (clz.startsWith('code-annotation-')) {
269
+ return true;
270
+ }
271
+ }
272
+ return false;
273
+ }
274
+ const clipboard = new window.ClipboardJS('.code-copy-button', {
275
+ text: function(trigger) {
276
+ const codeEl = trigger.previousElementSibling.cloneNode(true);
277
+ for (const childEl of codeEl.children) {
278
+ if (isCodeAnnotation(childEl)) {
279
+ childEl.remove();
280
+ }
281
+ }
282
+ return codeEl.innerText;
283
+ }
284
+ });
285
+ clipboard.on('success', function(e) {
286
+ // button target
287
+ const button = e.trigger;
288
+ // don't keep focus
289
+ button.blur();
290
+ // flash "checked"
291
+ button.classList.add('code-copy-button-checked');
292
+ var currentTitle = button.getAttribute("title");
293
+ button.setAttribute("title", "Copied!");
294
+ let tooltip;
295
+ if (window.bootstrap) {
296
+ button.setAttribute("data-bs-toggle", "tooltip");
297
+ button.setAttribute("data-bs-placement", "left");
298
+ button.setAttribute("data-bs-title", "Copied!");
299
+ tooltip = new bootstrap.Tooltip(button,
300
+ { trigger: "manual",
301
+ customClass: "code-copy-button-tooltip",
302
+ offset: [0, -8]});
303
+ tooltip.show();
304
+ }
305
+ setTimeout(function() {
306
+ if (tooltip) {
307
+ tooltip.hide();
308
+ button.removeAttribute("data-bs-title");
309
+ button.removeAttribute("data-bs-toggle");
310
+ button.removeAttribute("data-bs-placement");
311
+ }
312
+ button.setAttribute("title", currentTitle);
313
+ button.classList.remove('code-copy-button-checked');
314
+ }, 1000);
315
+ // clear code selection
316
+ e.clearSelection();
317
+ });
318
+ function tippyHover(el, contentFn) {
319
+ const config = {
320
+ allowHTML: true,
321
+ content: contentFn,
322
+ maxWidth: 500,
323
+ delay: 100,
324
+ arrow: false,
325
+ appendTo: function(el) {
326
+ return el.parentElement;
327
+ },
328
+ interactive: true,
329
+ interactiveBorder: 10,
330
+ theme: 'quarto',
331
+ placement: 'bottom-start'
332
+ };
333
+ window.tippy(el, config);
334
+ }
335
+ const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
336
+ for (var i=0; i<noterefs.length; i++) {
337
+ const ref = noterefs[i];
338
+ tippyHover(ref, function() {
339
+ // use id or data attribute instead here
340
+ let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
341
+ try { href = new URL(href).hash; } catch {}
342
+ const id = href.replace(/^#\/?/, "");
343
+ const note = window.document.getElementById(id);
344
+ return note.innerHTML;
345
+ });
346
+ }
347
+ let selectedAnnoteEl;
348
+ const selectorForAnnotation = ( cell, annotation) => {
349
+ let cellAttr = 'data-code-cell="' + cell + '"';
350
+ let lineAttr = 'data-code-annotation="' + annotation + '"';
351
+ const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
352
+ return selector;
353
+ }
354
+ const selectCodeLines = (annoteEl) => {
355
+ const doc = window.document;
356
+ const targetCell = annoteEl.getAttribute("data-target-cell");
357
+ const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
358
+ const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
359
+ const lines = annoteSpan.getAttribute("data-code-lines").split(",");
360
+ const lineIds = lines.map((line) => {
361
+ return targetCell + "-" + line;
362
+ })
363
+ let top = null;
364
+ let height = null;
365
+ let parent = null;
366
+ if (lineIds.length > 0) {
367
+ //compute the position of the single el (top and bottom and make a div)
368
+ const el = window.document.getElementById(lineIds[0]);
369
+ top = el.offsetTop;
370
+ height = el.offsetHeight;
371
+ parent = el.parentElement.parentElement;
372
+ if (lineIds.length > 1) {
373
+ const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
374
+ const bottom = lastEl.offsetTop + lastEl.offsetHeight;
375
+ height = bottom - top;
376
+ }
377
+ if (top !== null && height !== null && parent !== null) {
378
+ // cook up a div (if necessary) and position it
379
+ let div = window.document.getElementById("code-annotation-line-highlight");
380
+ if (div === null) {
381
+ div = window.document.createElement("div");
382
+ div.setAttribute("id", "code-annotation-line-highlight");
383
+ div.style.position = 'absolute';
384
+ parent.appendChild(div);
385
+ }
386
+ div.style.top = top - 2 + "px";
387
+ div.style.height = height + 4 + "px";
388
+ let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
389
+ if (gutterDiv === null) {
390
+ gutterDiv = window.document.createElement("div");
391
+ gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
392
+ gutterDiv.style.position = 'absolute';
393
+ const codeCell = window.document.getElementById(targetCell);
394
+ const gutter = codeCell.querySelector('.code-annotation-gutter');
395
+ gutter.appendChild(gutterDiv);
396
+ }
397
+ gutterDiv.style.top = top - 2 + "px";
398
+ gutterDiv.style.height = height + 4 + "px";
399
+ }
400
+ selectedAnnoteEl = annoteEl;
401
+ }
402
+ };
403
+ const unselectCodeLines = () => {
404
+ const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
405
+ elementsIds.forEach((elId) => {
406
+ const div = window.document.getElementById(elId);
407
+ if (div) {
408
+ div.remove();
409
+ }
410
+ });
411
+ selectedAnnoteEl = undefined;
412
+ };
413
+ // Attach click handler to the DT
414
+ const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
415
+ for (const annoteDlNode of annoteDls) {
416
+ annoteDlNode.addEventListener('click', (event) => {
417
+ const clickedEl = event.target;
418
+ if (clickedEl !== selectedAnnoteEl) {
419
+ unselectCodeLines();
420
+ const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
421
+ if (activeEl) {
422
+ activeEl.classList.remove('code-annotation-active');
423
+ }
424
+ selectCodeLines(clickedEl);
425
+ clickedEl.classList.add('code-annotation-active');
426
+ } else {
427
+ // Unselect the line
428
+ unselectCodeLines();
429
+ clickedEl.classList.remove('code-annotation-active');
430
+ }
431
+ });
432
+ }
433
+ const findCites = (el) => {
434
+ const parentEl = el.parentElement;
435
+ if (parentEl) {
436
+ const cites = parentEl.dataset.cites;
437
+ if (cites) {
438
+ return {
439
+ el,
440
+ cites: cites.split(' ')
441
+ };
442
+ } else {
443
+ return findCites(el.parentElement)
444
+ }
445
+ } else {
446
+ return undefined;
447
+ }
448
+ };
449
+ var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
450
+ for (var i=0; i<bibliorefs.length; i++) {
451
+ const ref = bibliorefs[i];
452
+ const citeInfo = findCites(ref);
453
+ if (citeInfo) {
454
+ tippyHover(citeInfo.el, function() {
455
+ var popup = window.document.createElement('div');
456
+ citeInfo.cites.forEach(function(cite) {
457
+ var citeDiv = window.document.createElement('div');
458
+ citeDiv.classList.add('hanging-indent');
459
+ citeDiv.classList.add('csl-entry');
460
+ var biblioDiv = window.document.getElementById('ref-' + cite);
461
+ if (biblioDiv) {
462
+ citeDiv.innerHTML = biblioDiv.innerHTML;
463
+ }
464
+ popup.appendChild(citeDiv);
465
+ });
466
+ return popup.innerHTML;
467
+ });
468
+ }
469
+ }
470
+ });
471
+ </script>
472
+ <nav class="page-navigation">
473
+ <div class="nav-page nav-page-previous">
474
+ <a href="./evenodd.html" class="pagination-link">
475
+ <i class="bi bi-arrow-left-short"></i> <span class="nav-page-text"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Even or Odd</span></span>
476
+ </a>
477
+ </div>
478
+ <div class="nav-page nav-page-next">
479
+ <a href="./countsheep.html" class="pagination-link">
480
+ <span class="nav-page-text"><span class="chapter-number">3</span>&nbsp; <span class="chapter-title">If you can’t sleep, just count sheep!!</span></span> <i class="bi bi-arrow-right-short"></i>
481
+ </a>
482
+ </div>
483
+ </nav>
484
+ </div> <!-- /content -->
485
+
486
+
487
+
488
+ </body></html>
reducegrow.html ADDED
@@ -0,0 +1,510 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 - 4&nbsp; Beginner - Reduce but Grow</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="./references.html" rel="next">
68
+ <link href="./countsheep.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>
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
+ <script id="quarto-search-options" type="application/json">{
79
+ "location": "sidebar",
80
+ "copy-button": false,
81
+ "collapse-after": 3,
82
+ "panel-placement": "start",
83
+ "type": "textbox",
84
+ "limit": 20,
85
+ "language": {
86
+ "search-no-results-text": "No results",
87
+ "search-matching-documents-text": "matching documents",
88
+ "search-copy-link-title": "Copy link to search",
89
+ "search-hide-matches-text": "Hide additional matches",
90
+ "search-more-match-text": "more match in this document",
91
+ "search-more-matches-text": "more matches in this document",
92
+ "search-clear-button-title": "Clear",
93
+ "search-detached-cancel-button-title": "Cancel",
94
+ "search-submit-button-title": "Submit",
95
+ "search-label": "Search"
96
+ }
97
+ }</script>
98
+
99
+
100
+ </head>
101
+
102
+ <body class="nav-sidebar floating">
103
+
104
+ <div id="quarto-search-results"></div>
105
+ <header id="quarto-header" class="headroom fixed-top">
106
+ <nav class="quarto-secondary-nav">
107
+ <div class="container-fluid d-flex">
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="./reducegrow.html"><span class="chapter-number">4</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();">
115
+ <i class="bi bi-search"></i>
116
+ </button>
117
+ </div>
118
+ </nav>
119
+ </header>
120
+ <!-- content -->
121
+ <div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article">
122
+ <!-- sidebar -->
123
+ <nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal sidebar-navigation floating overflow-auto">
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">
130
+ <div class="sidebar-search">
131
+ <div id="quarto-search" class="" title="Search"></div>
132
+ </div>
133
+ </div>
134
+ <div class="sidebar-menu-container">
135
+ <ul class="list-unstyled mt-1">
136
+ <li class="sidebar-item">
137
+ <div class="sidebar-item-container">
138
+ <a href="./index.html" class="sidebar-item-text sidebar-link">
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="./evenodd.html" class="sidebar-item-text sidebar-link">
145
+ <span class="menu-text"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Even or Odd</span></span></a>
146
+ </div>
147
+ </li>
148
+ <li class="sidebar-item">
149
+ <div class="sidebar-item-container">
150
+ <a href="./multiply.html" class="sidebar-item-text sidebar-link">
151
+ <span class="menu-text"><span class="chapter-number">2</span>&nbsp; <span class="chapter-title">Multiply</span></span></a>
152
+ </div>
153
+ </li>
154
+ <li class="sidebar-item">
155
+ <div class="sidebar-item-container">
156
+ <a href="./countsheep.html" class="sidebar-item-text sidebar-link">
157
+ <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>
158
+ </div>
159
+ </li>
160
+ <li class="sidebar-item">
161
+ <div class="sidebar-item-container">
162
+ <a href="./reducegrow.html" class="sidebar-item-text sidebar-link active">
163
+ <span class="menu-text"><span class="chapter-number">4</span>&nbsp; <span class="chapter-title">Beginner - Reduce but Grow</span></span></a>
164
+ </div>
165
+ </li>
166
+ <li class="sidebar-item">
167
+ <div class="sidebar-item-container">
168
+ <a href="./references.html" class="sidebar-item-text sidebar-link">
169
+ <span class="menu-text">References</span></a>
170
+ </div>
171
+ </li>
172
+ </ul>
173
+ </div>
174
+ </nav>
175
+ <div id="quarto-sidebar-glass" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass"></div>
176
+ <!-- margin-sidebar -->
177
+ <div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
178
+ <nav id="TOC" role="doc-toc" class="toc-active">
179
+ <h2 id="toc-title">Table of contents</h2>
180
+
181
+ <ul>
182
+ <li><a href="#youtube-video" id="toc-youtube-video" class="nav-link active" data-scroll-target="#youtube-video"><span class="header-section-number">4.1</span> YouTube Video</a></li>
183
+ <li><a href="#solution-code" id="toc-solution-code" class="nav-link" data-scroll-target="#solution-code"><span class="header-section-number">4.2</span> Solution Code</a></li>
184
+ <li><a href="#test" id="toc-test" class="nav-link" data-scroll-target="#test"><span class="header-section-number">4.3</span> Test</a></li>
185
+ <li><a href="#supported-by" id="toc-supported-by" class="nav-link" data-scroll-target="#supported-by"><span class="header-section-number">4.4</span> Supported by</a></li>
186
+ </ul>
187
+ </nav>
188
+ </div>
189
+ <!-- main -->
190
+ <main class="content" id="quarto-document-content">
191
+
192
+ <header id="title-block-header" class="quarto-title-block default">
193
+ <div class="quarto-title">
194
+ <h1 class="title"><span id="reducegrow" class="quarto-section-identifier"><span class="chapter-number">4</span>&nbsp; <span class="chapter-title">Beginner - Reduce but Grow</span></span></h1>
195
+ </div>
196
+
197
+
198
+
199
+ <div class="quarto-title-meta">
200
+
201
+
202
+
203
+
204
+ </div>
205
+
206
+
207
+ </header>
208
+
209
+ <p><a href="https://www.codewars.com/kata/57f780909f7e8e3183000078/train/r" class="uri">https://www.codewars.com/kata/57f780909f7e8e3183000078/train/r</a></p>
210
+ <p>Given a non-empty array of integers, return the result of multiplying the values together in order. Example:</p>
211
+ <pre><code>[1, 2, 3, 4] =&gt; 1 * 2 * 3 * 4 = 24</code></pre>
212
+ <section id="youtube-video" class="level2" data-number="4.1">
213
+ <h2 data-number="4.1" class="anchored" data-anchor-id="youtube-video"><span class="header-section-number">4.1</span> YouTube Video</h2>
214
+ <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>
215
+ </section>
216
+ <section id="solution-code" class="level2" data-number="4.2">
217
+ <h2 data-number="4.2" class="anchored" data-anchor-id="solution-code"><span class="header-section-number">4.2</span> Solution Code</h2>
218
+ <p>Solusi bar-bar</p>
219
+ <div class="cell">
220
+ <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>
221
+ <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>
222
+ <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>
223
+ <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>
224
+ <span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a> }</span>
225
+ <span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">return</span>(result)</span>
226
+ <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>
227
+ </div>
228
+ <p>Solusi simple</p>
229
+ <div class="cell">
230
+ <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>
231
+ <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>
232
+ </div>
233
+ </section>
234
+ <section id="test" class="level2" data-number="4.3">
235
+ <h2 data-number="4.3" class="anchored" data-anchor-id="test"><span class="header-section-number">4.3</span> Test</h2>
236
+ <div class="cell">
237
+ <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>
238
+ <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>
239
+ <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>
240
+ <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>
241
+ <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>
242
+ <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>
243
+ <div class="cell-output cell-output-stdout">
244
+ <pre><code>Test passed 🎉</code></pre>
245
+ </div>
246
+ </div>
247
+ </section>
248
+ <section id="supported-by" class="level2" data-number="4.4">
249
+ <h2 data-number="4.4" class="anchored" data-anchor-id="supported-by"><span class="header-section-number">4.4</span> Supported by</h2>
250
+ <div class="quarto-figure quarto-figure-center">
251
+ <figure class="figure">
252
+ <p><a href="https://www.starcore.co"><img src="new_starcore_logo.png" class="img-fluid figure-img"></a></p>
253
+ <figcaption class="figure-caption">StarCore Analytics</figcaption>
254
+ </figure>
255
+ </div>
256
+
257
+
258
+ </section>
259
+
260
+ </main> <!-- /main -->
261
+ <script id="quarto-html-after-body" type="application/javascript">
262
+ window.document.addEventListener("DOMContentLoaded", function (event) {
263
+ const toggleBodyColorMode = (bsSheetEl) => {
264
+ const mode = bsSheetEl.getAttribute("data-mode");
265
+ const bodyEl = window.document.querySelector("body");
266
+ if (mode === "dark") {
267
+ bodyEl.classList.add("quarto-dark");
268
+ bodyEl.classList.remove("quarto-light");
269
+ } else {
270
+ bodyEl.classList.add("quarto-light");
271
+ bodyEl.classList.remove("quarto-dark");
272
+ }
273
+ }
274
+ const toggleBodyColorPrimary = () => {
275
+ const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
276
+ if (bsSheetEl) {
277
+ toggleBodyColorMode(bsSheetEl);
278
+ }
279
+ }
280
+ toggleBodyColorPrimary();
281
+ const icon = "";
282
+ const anchorJS = new window.AnchorJS();
283
+ anchorJS.options = {
284
+ placement: 'right',
285
+ icon: icon
286
+ };
287
+ anchorJS.add('.anchored');
288
+ const isCodeAnnotation = (el) => {
289
+ for (const clz of el.classList) {
290
+ if (clz.startsWith('code-annotation-')) {
291
+ return true;
292
+ }
293
+ }
294
+ return false;
295
+ }
296
+ const clipboard = new window.ClipboardJS('.code-copy-button', {
297
+ text: function(trigger) {
298
+ const codeEl = trigger.previousElementSibling.cloneNode(true);
299
+ for (const childEl of codeEl.children) {
300
+ if (isCodeAnnotation(childEl)) {
301
+ childEl.remove();
302
+ }
303
+ }
304
+ return codeEl.innerText;
305
+ }
306
+ });
307
+ clipboard.on('success', function(e) {
308
+ // button target
309
+ const button = e.trigger;
310
+ // don't keep focus
311
+ button.blur();
312
+ // flash "checked"
313
+ button.classList.add('code-copy-button-checked');
314
+ var currentTitle = button.getAttribute("title");
315
+ button.setAttribute("title", "Copied!");
316
+ let tooltip;
317
+ if (window.bootstrap) {
318
+ button.setAttribute("data-bs-toggle", "tooltip");
319
+ button.setAttribute("data-bs-placement", "left");
320
+ button.setAttribute("data-bs-title", "Copied!");
321
+ tooltip = new bootstrap.Tooltip(button,
322
+ { trigger: "manual",
323
+ customClass: "code-copy-button-tooltip",
324
+ offset: [0, -8]});
325
+ tooltip.show();
326
+ }
327
+ setTimeout(function() {
328
+ if (tooltip) {
329
+ tooltip.hide();
330
+ button.removeAttribute("data-bs-title");
331
+ button.removeAttribute("data-bs-toggle");
332
+ button.removeAttribute("data-bs-placement");
333
+ }
334
+ button.setAttribute("title", currentTitle);
335
+ button.classList.remove('code-copy-button-checked');
336
+ }, 1000);
337
+ // clear code selection
338
+ e.clearSelection();
339
+ });
340
+ function tippyHover(el, contentFn) {
341
+ const config = {
342
+ allowHTML: true,
343
+ content: contentFn,
344
+ maxWidth: 500,
345
+ delay: 100,
346
+ arrow: false,
347
+ appendTo: function(el) {
348
+ return el.parentElement;
349
+ },
350
+ interactive: true,
351
+ interactiveBorder: 10,
352
+ theme: 'quarto',
353
+ placement: 'bottom-start'
354
+ };
355
+ window.tippy(el, config);
356
+ }
357
+ const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
358
+ for (var i=0; i<noterefs.length; i++) {
359
+ const ref = noterefs[i];
360
+ tippyHover(ref, function() {
361
+ // use id or data attribute instead here
362
+ let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
363
+ try { href = new URL(href).hash; } catch {}
364
+ const id = href.replace(/^#\/?/, "");
365
+ const note = window.document.getElementById(id);
366
+ return note.innerHTML;
367
+ });
368
+ }
369
+ let selectedAnnoteEl;
370
+ const selectorForAnnotation = ( cell, annotation) => {
371
+ let cellAttr = 'data-code-cell="' + cell + '"';
372
+ let lineAttr = 'data-code-annotation="' + annotation + '"';
373
+ const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
374
+ return selector;
375
+ }
376
+ const selectCodeLines = (annoteEl) => {
377
+ const doc = window.document;
378
+ const targetCell = annoteEl.getAttribute("data-target-cell");
379
+ const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
380
+ const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
381
+ const lines = annoteSpan.getAttribute("data-code-lines").split(",");
382
+ const lineIds = lines.map((line) => {
383
+ return targetCell + "-" + line;
384
+ })
385
+ let top = null;
386
+ let height = null;
387
+ let parent = null;
388
+ if (lineIds.length > 0) {
389
+ //compute the position of the single el (top and bottom and make a div)
390
+ const el = window.document.getElementById(lineIds[0]);
391
+ top = el.offsetTop;
392
+ height = el.offsetHeight;
393
+ parent = el.parentElement.parentElement;
394
+ if (lineIds.length > 1) {
395
+ const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
396
+ const bottom = lastEl.offsetTop + lastEl.offsetHeight;
397
+ height = bottom - top;
398
+ }
399
+ if (top !== null && height !== null && parent !== null) {
400
+ // cook up a div (if necessary) and position it
401
+ let div = window.document.getElementById("code-annotation-line-highlight");
402
+ if (div === null) {
403
+ div = window.document.createElement("div");
404
+ div.setAttribute("id", "code-annotation-line-highlight");
405
+ div.style.position = 'absolute';
406
+ parent.appendChild(div);
407
+ }
408
+ div.style.top = top - 2 + "px";
409
+ div.style.height = height + 4 + "px";
410
+ let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
411
+ if (gutterDiv === null) {
412
+ gutterDiv = window.document.createElement("div");
413
+ gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
414
+ gutterDiv.style.position = 'absolute';
415
+ const codeCell = window.document.getElementById(targetCell);
416
+ const gutter = codeCell.querySelector('.code-annotation-gutter');
417
+ gutter.appendChild(gutterDiv);
418
+ }
419
+ gutterDiv.style.top = top - 2 + "px";
420
+ gutterDiv.style.height = height + 4 + "px";
421
+ }
422
+ selectedAnnoteEl = annoteEl;
423
+ }
424
+ };
425
+ const unselectCodeLines = () => {
426
+ const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
427
+ elementsIds.forEach((elId) => {
428
+ const div = window.document.getElementById(elId);
429
+ if (div) {
430
+ div.remove();
431
+ }
432
+ });
433
+ selectedAnnoteEl = undefined;
434
+ };
435
+ // Attach click handler to the DT
436
+ const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
437
+ for (const annoteDlNode of annoteDls) {
438
+ annoteDlNode.addEventListener('click', (event) => {
439
+ const clickedEl = event.target;
440
+ if (clickedEl !== selectedAnnoteEl) {
441
+ unselectCodeLines();
442
+ const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
443
+ if (activeEl) {
444
+ activeEl.classList.remove('code-annotation-active');
445
+ }
446
+ selectCodeLines(clickedEl);
447
+ clickedEl.classList.add('code-annotation-active');
448
+ } else {
449
+ // Unselect the line
450
+ unselectCodeLines();
451
+ clickedEl.classList.remove('code-annotation-active');
452
+ }
453
+ });
454
+ }
455
+ const findCites = (el) => {
456
+ const parentEl = el.parentElement;
457
+ if (parentEl) {
458
+ const cites = parentEl.dataset.cites;
459
+ if (cites) {
460
+ return {
461
+ el,
462
+ cites: cites.split(' ')
463
+ };
464
+ } else {
465
+ return findCites(el.parentElement)
466
+ }
467
+ } else {
468
+ return undefined;
469
+ }
470
+ };
471
+ var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
472
+ for (var i=0; i<bibliorefs.length; i++) {
473
+ const ref = bibliorefs[i];
474
+ const citeInfo = findCites(ref);
475
+ if (citeInfo) {
476
+ tippyHover(citeInfo.el, function() {
477
+ var popup = window.document.createElement('div');
478
+ citeInfo.cites.forEach(function(cite) {
479
+ var citeDiv = window.document.createElement('div');
480
+ citeDiv.classList.add('hanging-indent');
481
+ citeDiv.classList.add('csl-entry');
482
+ var biblioDiv = window.document.getElementById('ref-' + cite);
483
+ if (biblioDiv) {
484
+ citeDiv.innerHTML = biblioDiv.innerHTML;
485
+ }
486
+ popup.appendChild(citeDiv);
487
+ });
488
+ return popup.innerHTML;
489
+ });
490
+ }
491
+ }
492
+ });
493
+ </script>
494
+ <nav class="page-navigation">
495
+ <div class="nav-page nav-page-previous">
496
+ <a href="./countsheep.html" class="pagination-link">
497
+ <i class="bi bi-arrow-left-short"></i> <span class="nav-page-text"><span class="chapter-number">3</span>&nbsp; <span class="chapter-title">If you can’t sleep, just count sheep!!</span></span>
498
+ </a>
499
+ </div>
500
+ <div class="nav-page nav-page-next">
501
+ <a href="./references.html" class="pagination-link">
502
+ <span class="nav-page-text">References</span> <i class="bi bi-arrow-right-short"></i>
503
+ </a>
504
+ </div>
505
+ </nav>
506
+ </div> <!-- /content -->
507
+
508
+
509
+
510
+ </body></html>
references.html CHANGED
@@ -49,7 +49,7 @@ div.csl-indent {
49
  <script src="site_libs/quarto-search/fuse.min.js"></script>
50
  <script src="site_libs/quarto-search/quarto-search.js"></script>
51
  <meta name="quarto:offset" content="./">
52
- <link href="./001-reducegrow.html" rel="prev">
53
  <script src="site_libs/quarto-html/quarto.js"></script>
54
  <script src="site_libs/quarto-html/popper.min.js"></script>
55
  <script src="site_libs/quarto-html/tippy.umd.min.js"></script>
@@ -125,8 +125,26 @@ div.csl-indent {
125
  </li>
126
  <li class="sidebar-item">
127
  <div class="sidebar-item-container">
128
- <a href="./001-reducegrow.html" class="sidebar-item-text sidebar-link">
129
- <span class="menu-text"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Beginner - Reduce but Grow</span></span></a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  </div>
131
  </li>
132
  <li class="sidebar-item">
@@ -405,8 +423,8 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
405
  </script>
406
  <nav class="page-navigation">
407
  <div class="nav-page nav-page-previous">
408
- <a href="./001-reducegrow.html" class="pagination-link">
409
- <i class="bi bi-arrow-left-short"></i> <span class="nav-page-text"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Beginner - Reduce but Grow</span></span>
410
  </a>
411
  </div>
412
  <div class="nav-page nav-page-next">
 
49
  <script src="site_libs/quarto-search/fuse.min.js"></script>
50
  <script src="site_libs/quarto-search/quarto-search.js"></script>
51
  <meta name="quarto:offset" content="./">
52
+ <link href="./reducegrow.html" rel="prev">
53
  <script src="site_libs/quarto-html/quarto.js"></script>
54
  <script src="site_libs/quarto-html/popper.min.js"></script>
55
  <script src="site_libs/quarto-html/tippy.umd.min.js"></script>
 
125
  </li>
126
  <li class="sidebar-item">
127
  <div class="sidebar-item-container">
128
+ <a href="./evenodd.html" class="sidebar-item-text sidebar-link">
129
+ <span class="menu-text"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Even or Odd</span></span></a>
130
+ </div>
131
+ </li>
132
+ <li class="sidebar-item">
133
+ <div class="sidebar-item-container">
134
+ <a href="./multiply.html" class="sidebar-item-text sidebar-link">
135
+ <span class="menu-text"><span class="chapter-number">2</span>&nbsp; <span class="chapter-title">Multiply</span></span></a>
136
+ </div>
137
+ </li>
138
+ <li class="sidebar-item">
139
+ <div class="sidebar-item-container">
140
+ <a href="./countsheep.html" class="sidebar-item-text sidebar-link">
141
+ <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>
142
+ </div>
143
+ </li>
144
+ <li class="sidebar-item">
145
+ <div class="sidebar-item-container">
146
+ <a href="./reducegrow.html" class="sidebar-item-text sidebar-link">
147
+ <span class="menu-text"><span class="chapter-number">4</span>&nbsp; <span class="chapter-title">Beginner - Reduce but Grow</span></span></a>
148
  </div>
149
  </li>
150
  <li class="sidebar-item">
 
423
  </script>
424
  <nav class="page-navigation">
425
  <div class="nav-page nav-page-previous">
426
+ <a href="./reducegrow.html" class="pagination-link">
427
+ <i class="bi bi-arrow-left-short"></i> <span class="nav-page-text"><span class="chapter-number">4</span>&nbsp; <span class="chapter-title">Beginner - Reduce but Grow</span></span>
428
  </a>
429
  </div>
430
  <div class="nav-page nav-page-next">