<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Daniel Mutwiri</title>
    <description>The latest articles on DEV Community by Daniel Mutwiri (@gitonga123).</description>
    <link>https://dev.to/gitonga123</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F878215%2F9e239a13-eba7-418d-b4d4-2850b33747f7.jpeg</url>
      <title>DEV Community: Daniel Mutwiri</title>
      <link>https://dev.to/gitonga123</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gitonga123"/>
    <language>en</language>
    <item>
      <title>LUX TECH ACADEMY- Data Structure and Algorithms Week 1</title>
      <dc:creator>Daniel Mutwiri</dc:creator>
      <pubDate>Thu, 16 Jun 2022 16:03:22 +0000</pubDate>
      <link>https://dev.to/gitonga123/lux-tech-academy-data-structure-and-algorithms-week-1-1gmo</link>
      <guid>https://dev.to/gitonga123/lux-tech-academy-data-structure-and-algorithms-week-1-1gmo</guid>
      <description>&lt;p&gt;&lt;a href="https://www.hackerrank.com/challenges/simple-array-sum/problem?isFullScreen=true"&gt;https://www.hackerrank.com/challenges/simple-array-sum/problem?isFullScreen=true&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solutions&lt;/strong&gt;&lt;br&gt;
Solution 1.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function simpleArraySum(ar) {
    // using a forEach or a for loop
   let sum = 0;
   ar.forEach((element) =&amp;gt; {
      sum = sum + element;
   });
  return sum;
 }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Solution 2.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function simpleArraySum(ar) {
    // Using a inbuilt function reduce.
    return ar.reduce((a, b) =&amp;gt; a+b, 0);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>javascript</category>
      <category>luxtech</category>
      <category>ds</category>
      <category>algorithms</category>
    </item>
  </channel>
</rss>
