<?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: Abu Saleh Faysal</title>
    <description>The latest articles on DEV Community by Abu Saleh Faysal (@abusalehfaysal).</description>
    <link>https://dev.to/abusalehfaysal</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%2F625885%2F499ea204-6b77-4946-97e0-7588ce1dceb6.jpg</url>
      <title>DEV Community: Abu Saleh Faysal</title>
      <link>https://dev.to/abusalehfaysal</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/abusalehfaysal"/>
    <language>en</language>
    <item>
      <title>20. Valid Parentheses - JavaScript Solution - by Abu Saleh Faysal</title>
      <dc:creator>Abu Saleh Faysal</dc:creator>
      <pubDate>Fri, 10 Feb 2023 14:54:08 +0000</pubDate>
      <link>https://dev.to/abusalehfaysal/20-valid-parentheses-javascript-solution-by-abu-saleh-faysal-3akn</link>
      <guid>https://dev.to/abusalehfaysal/20-valid-parentheses-javascript-solution-by-abu-saleh-faysal-3akn</guid>
      <description>&lt;p&gt;An array of parentheses are given. We need to find out if the array contains both opening and closing parentheses or not.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Declare a variable called "stack" and store an empty array.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Iterate a for loop over the given array and store the array elements inside a variable called "char".&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Using switch case, check the elements and in case the individual element is an opening parenthesis, push a closing parentheses in stack array which was declared earlier.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the individual element is not an opening parentheses, take the last element from stack array and store it inside a variable named "topElement".&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If "topElement" is not equal to "char", return false.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After the completed iteration, check the length of "stack" array is zero, if it is zero, return true and if it is not zero, return false.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Runtime: 86 ms.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Memory: 42.8 MB.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/**
 * @param {string} s
 * @return {boolean}
 */
var isValid = function(s) {
     let stack = [];

     for(let i = 0; i &amp;lt; s.length; i++) {
         let char = s[i];

         switch(char) {
             case "(": stack.push(")");
             break;

             case "{": stack.push("}");
             break;

             case "[": stack.push("]");
             break;

             default: 
             let topElement = stack.pop();
             if(char !== topElement) {
                 return false;
             }
         }

     }
     return stack.length === 0;
};

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;👉 Support me: &lt;a href="https://www.buymeacoffee.com/abusalehfaysal"&gt;https://www.buymeacoffee.com/abusalehfaysal&lt;/a&gt;&lt;br&gt;
👉 YouTube Channel: &lt;a href="https://www.youtube.com/@thebacklogprogrammer"&gt;https://www.youtube.com/@thebacklogprogrammer&lt;/a&gt;&lt;br&gt;
👉 PlayList Link: &lt;a href="https://youtube.com/playlist?list=PLUnklBXn8NSefCpBaLe39mds6dQx-tDDD"&gt;https://youtube.com/playlist?list=PLUnklBXn8NSefCpBaLe39mds6dQx-tDDD&lt;/a&gt;&lt;br&gt;
👉 Connect with me (LinkedIn): &lt;a href="https://www.linkedin.com/in/abusalehfaysal"&gt;https://www.linkedin.com/in/abusalehfaysal&lt;/a&gt;&lt;br&gt;
👉 Follow our LinkedIn Page: &lt;a href="https://www.linkedin.com/company/thebacklogprogrammer/"&gt;https://www.linkedin.com/company/thebacklogprogrammer/&lt;/a&gt;&lt;br&gt;
👉 Like our Facebook page: &lt;a href="https://www.facebook.com/thebacklogprogrammer/"&gt;https://www.facebook.com/thebacklogprogrammer/&lt;/a&gt;&lt;br&gt;
👉 Join our community (Facebook group): &lt;a href="https://www.facebook.com/groups/5500588936676942/"&gt;https://www.facebook.com/groups/5500588936676942/&lt;/a&gt;&lt;br&gt;
👉 Follow me at: &lt;a href="https://www.facebook.com/AbuSalehFaysal10"&gt;https://www.facebook.com/AbuSalehFaysal10&lt;/a&gt;&lt;br&gt;
👉 Twitter: &lt;a href="https://twitter.com/AbuSalehFaysal"&gt;https://twitter.com/AbuSalehFaysal&lt;/a&gt;&lt;br&gt;
👉 Abu Saleh Faysal’s Blog: &lt;a href="https://abusalehfaysal.hashnode.dev/"&gt;https://abusalehfaysal.hashnode.dev/&lt;/a&gt;&lt;br&gt;
👉 Hasnode: &lt;a href="https://hashnode.com/@AbuSalehFaysal"&gt;https://hashnode.com/@AbuSalehFaysal&lt;/a&gt;&lt;br&gt;
👉 Dev Community: &lt;a href="https://dev.to/abusalehfaysal"&gt;https://dev.to/abusalehfaysal&lt;/a&gt;&lt;br&gt;
👉 freeCodeCamp: &lt;a href="https://www.freecodecamp.org/abusalehfaysal"&gt;https://www.freecodecamp.org/abusalehfaysal&lt;/a&gt;&lt;br&gt;
👉 Medium: &lt;a href="https://abusalehfaysal.medium.com/"&gt;https://abusalehfaysal.medium.com/&lt;/a&gt;&lt;br&gt;
👉 GitHub: &lt;a href="https://github.com/AbuSalehFaysal"&gt;https://github.com/AbuSalehFaysal&lt;/a&gt;&lt;br&gt;
👉 GitLab: &lt;a href="https://gitlab.com/AbuSalehFaysal"&gt;https://gitlab.com/AbuSalehFaysal&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>14. Longest Common Prefix - JavaScript Solution - by Abu Saleh Faysal</title>
      <dc:creator>Abu Saleh Faysal</dc:creator>
      <pubDate>Fri, 20 Jan 2023 18:23:30 +0000</pubDate>
      <link>https://dev.to/abusalehfaysal/14-longest-common-prefix-javascript-solution-by-abu-saleh-faysal-2fle</link>
      <guid>https://dev.to/abusalehfaysal/14-longest-common-prefix-javascript-solution-by-abu-saleh-faysal-2fle</guid>
      <description>&lt;p&gt;After seeing the problem, I determined that iterating the first element of the array and iterating the whole array could be a straightforward approach to solving this problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Step 01:&lt;/strong&gt; declare a variable named "prefix" and set the initial value as an empty string("").&lt;br&gt;
&lt;strong&gt;Step 02:&lt;/strong&gt; Check if the given array length is 0 or if the given array is null. If it meets this condition, return the prefix which is an empty string.&lt;br&gt;
&lt;strong&gt;Step 03:&lt;/strong&gt; If the given array does not meet the previous condition, iterate the first element of the array using a for loop and store the elements in the "char" variable.&lt;br&gt;
&lt;strong&gt;Step 04:&lt;/strong&gt; Using another for loop, iterate the given array and this time start the iteration from the second index of the array.&lt;br&gt;
&lt;strong&gt;Step 05:&lt;/strong&gt; If the char and the second element of the given array's char is not equal, then return the prefix.&lt;br&gt;
&lt;strong&gt;Step 06:&lt;/strong&gt; After the second iteration, add the char with the prefix.&lt;br&gt;
&lt;strong&gt;Step 07:&lt;/strong&gt; Return the prefix.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Runtime:&lt;/strong&gt; 93 ms&lt;br&gt;
&lt;strong&gt;Memory:&lt;/strong&gt; 42.9 MB&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/**
 * @param {string[]} strs
 * @return {string}
 */
var longestCommonPrefix = function(strs) {
    let prefix = "";

    if(strs.length === 0 || strs === null) return prefix;

    for(let i = 0; i &amp;lt; strs[0].length; i++) {
        let char = strs[0][i];
        for(let j = 1; j &amp;lt; strs.length; j++) {
            if(char !== strs[j][i]) {
                return prefix;
            }
        }
        prefix += char;
    }

    return prefix;
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;👉 Support me: &lt;a href="https://www.buymeacoffee.com/abusalehfaysal" rel="noopener noreferrer"&gt;https://www.buymeacoffee.com/abusalehfaysal&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 YouTube Channel: &lt;a href="https://www.youtube.com/channel/UCW_09Nbobf4URLkAlEo84sw" rel="noopener noreferrer"&gt;https://www.youtube.com/channel/UCW_09Nbobf4URLkAlEo84sw&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 PlayList Link: &lt;a href="https://youtube.com/playlist?list=PLUnklBXn8NSefCpBaLe39mds6dQx-tDDD" rel="noopener noreferrer"&gt;https://youtube.com/playlist?list=PLUnklBXn8NSefCpBaLe39mds6dQx-tDDD&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 Connect with me (LinkedIn): &lt;a href="https://www.linkedin.com/in/abusalehfaysal" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/abusalehfaysal&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 Follow our LinkedIn Page: &lt;a href="https://www.linkedin.com/company/thebacklogprogrammer/" rel="noopener noreferrer"&gt;https://www.linkedin.com/company/thebacklogprogrammer/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 Like our Facebook page: &lt;a href="https://www.facebook.com/thebacklogprogrammer/" rel="noopener noreferrer"&gt;https://www.facebook.com/thebacklogprogrammer/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 Join our community (Facebook group): &lt;a href="https://www.facebook.com/groups/5500588936676942/" rel="noopener noreferrer"&gt;https://www.facebook.com/groups/5500588936676942/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 Follow me at: &lt;a href="https://www.facebook.com/AbuSalehFaysal10" rel="noopener noreferrer"&gt;https://www.facebook.com/AbuSalehFaysal10&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 Twitter: &lt;a href="https://twitter.com/AbuSalehFaysal" rel="noopener noreferrer"&gt;https://twitter.com/AbuSalehFaysal&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 Abu Saleh Faysal’s Blog: &lt;a href="https://abusalehfaysal.hashnode.dev/" rel="noopener noreferrer"&gt;https://abusalehfaysal.hashnode.dev/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 Hasnode: &lt;a href="https://hashnode.com/@AbuSalehFaysal" rel="noopener noreferrer"&gt;https://hashnode.com/@AbuSalehFaysal&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 Dev Community: &lt;a href="https://dev.to/abusalehfaysal"&gt;https://dev.to/abusalehfaysal&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 freeCodeCamp: &lt;a href="https://www.freecodecamp.org/abusalehfaysal" rel="noopener noreferrer"&gt;https://www.freecodecamp.org/abusalehfaysal&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 Medium: &lt;a href="https://abusalehfaysal.medium.com/" rel="noopener noreferrer"&gt;https://abusalehfaysal.medium.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 GitHub: &lt;a href="https://github.com/AbuSalehFaysal" rel="noopener noreferrer"&gt;https://github.com/AbuSalehFaysal&lt;/a&gt;&lt;br&gt;
👉 GitLab: &lt;a href="https://gitlab.com/AbuSalehFaysal" rel="noopener noreferrer"&gt;https://gitlab.com/AbuSalehFaysal&lt;/a&gt;&lt;/p&gt;

</description>
      <category>career</category>
      <category>mentorship</category>
      <category>discuss</category>
    </item>
    <item>
      <title>13. Roman to Integer - JavaScript Solution - by Abu Saleh Faysal</title>
      <dc:creator>Abu Saleh Faysal</dc:creator>
      <pubDate>Wed, 07 Dec 2022 20:42:59 +0000</pubDate>
      <link>https://dev.to/abusalehfaysal/13-roman-to-integer-javascript-solution-by-abu-saleh-faysal-20ka</link>
      <guid>https://dev.to/abusalehfaysal/13-roman-to-integer-javascript-solution-by-abu-saleh-faysal-20ka</guid>
      <description>&lt;p&gt;Given a roman numeral, we need to convert it to an integer.&lt;/p&gt;

&lt;p&gt;After seeing the problem, I thought that I can try with an object to store the roman symbol value and for loop to access the given string.&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Step 01:&lt;/strong&gt; Store the roman symbol value in a variable called "romanSymbolValue".&lt;br&gt;
&lt;strong&gt;Step 02:&lt;/strong&gt; Declare a variable called "result" and set the initial value as 0.&lt;br&gt;
&lt;strong&gt;Step 03:&lt;/strong&gt; Run a for loop, and identify the string symbol value, if the first character symbols value is less than the next symbols value, subtract the first value from the next value and add with the result; Then increment the index value by one.&lt;br&gt;
&lt;strong&gt;Step 04:&lt;/strong&gt; If there is only one character or the first character's symbol value is not less than the next character's symbol value, then, add the first character's symbol value with the result.&lt;br&gt;
&lt;strong&gt;Step 05:&lt;/strong&gt; Return the result.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/**
 * @param {string} s
 * @return {number}
 */
var romanToInt = function(s) {
    const romanSymbolValue = {
        "I": 1,
        "V": 5,
        "X": 10,
        "L": 50,
        "C": 100,
        "D": 500,
        "M": 1000
    }

    let result = 0;

    for(let i = 0; i &amp;lt; s.length; i++) {
        const firstSymbolValue = romanSymbolValue[s[i]];
        const secondSymbolValue = romanSymbolValue[s[i+1]];

        if(firstSymbolValue &amp;lt; secondSymbolValue) {
            result += secondSymbolValue - firstSymbolValue;
            i++;
        } else {
            result += firstSymbolValue;
        }
    }

    return result;
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;👉 Support me: &lt;a href="https://www.buymeacoffee.com/abusalehfaysal" rel="noopener noreferrer"&gt;https://www.buymeacoffee.com/abusalehfaysal&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 YouTube Video Link: &lt;a href="https://youtu.be/c081jEHzsvo" rel="noopener noreferrer"&gt;https://youtu.be/c081jEHzsvo&lt;/a&gt;&lt;br&gt;
👉 YouTube Channel: &lt;a href="https://www.youtube.com/channel/UCW_09Nbobf4URLkAlEo84sw" rel="noopener noreferrer"&gt;https://www.youtube.com/channel/UCW_09Nbobf4URLkAlEo84sw&lt;/a&gt;&lt;br&gt;
👉 PlayList Link: &lt;a href="https://youtube.com/playlist?list=PLUnklBXn8NSefCpBaLe39mds6dQx-tDDD" rel="noopener noreferrer"&gt;https://youtube.com/playlist?list=PLUnklBXn8NSefCpBaLe39mds6dQx-tDDD&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 Connect with me (LinkedIn): &lt;a href="https://www.linkedin.com/in/abusalehfaysal" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/abusalehfaysal&lt;/a&gt;&lt;br&gt;
👉 Follow our LinkedIn Page: &lt;br&gt;
👉 Like our Facebook page: &lt;a href="https://www.facebook.com/thebacklogprogrammer/" rel="noopener noreferrer"&gt;https://www.facebook.com/thebacklogprogrammer/&lt;/a&gt;&lt;br&gt;
👉 Join our community (Facebook group): &lt;a href="https://www.facebook.com/groups/5500588936676942/" rel="noopener noreferrer"&gt;https://www.facebook.com/groups/5500588936676942/&lt;/a&gt;&lt;br&gt;
👉 Follow me at: &lt;a href="https://www.facebook.com/AbuSalehFaysal10" rel="noopener noreferrer"&gt;https://www.facebook.com/AbuSalehFaysal10&lt;/a&gt;&lt;br&gt;
👉 Twitter: &lt;a href="https://twitter.com/AbuSalehFaysal" rel="noopener noreferrer"&gt;https://twitter.com/AbuSalehFaysal&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 Abu Saleh Faysal’s Blog: &lt;a href="https://abusalehfaysal.hashnode.dev/" rel="noopener noreferrer"&gt;https://abusalehfaysal.hashnode.dev/&lt;/a&gt;&lt;br&gt;
👉 Hasnode: &lt;a href="https://hashnode.com/@AbuSalehFaysal" rel="noopener noreferrer"&gt;https://hashnode.com/@AbuSalehFaysal&lt;/a&gt;&lt;br&gt;
👉 Dev Community: &lt;a href="https://dev.to/abusalehfaysal"&gt;https://dev.to/abusalehfaysal&lt;/a&gt;&lt;br&gt;
👉 freeCodeCamp: &lt;a href="https://www.freecodecamp.org/abusalehfaysal" rel="noopener noreferrer"&gt;https://www.freecodecamp.org/abusalehfaysal&lt;/a&gt;&lt;br&gt;
👉 Medium: &lt;a href="https://abusalehfaysal.medium.com/" rel="noopener noreferrer"&gt;https://abusalehfaysal.medium.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 GitHub: &lt;a href="https://github.com/AbuSalehFaysal" rel="noopener noreferrer"&gt;https://github.com/AbuSalehFaysal&lt;/a&gt;&lt;br&gt;
👉 GitLab: &lt;a href="https://gitlab.com/AbuSalehFaysal" rel="noopener noreferrer"&gt;https://gitlab.com/AbuSalehFaysal&lt;/a&gt;&lt;/p&gt;

</description>
      <category>watercooler</category>
    </item>
    <item>
      <title>9. Palindrome Number - JavaScript Solution - by Abu Saleh Faysal</title>
      <dc:creator>Abu Saleh Faysal</dc:creator>
      <pubDate>Thu, 01 Dec 2022 10:55:38 +0000</pubDate>
      <link>https://dev.to/abusalehfaysal/9-palindrome-number-javascript-solution-by-abu-saleh-faysal-113j</link>
      <guid>https://dev.to/abusalehfaysal/9-palindrome-number-javascript-solution-by-abu-saleh-faysal-113j</guid>
      <description>&lt;p&gt;Checking "Palindrome number" is a very widespread problem. Compared to the other languages, I found it easier to solve this problem with JavaScript.&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Step 01:&lt;/strong&gt; Convert x into string using toString().&lt;br&gt;
&lt;strong&gt;Step 02:&lt;/strong&gt; Split the string using split().&lt;br&gt;
&lt;strong&gt;Step 03:&lt;/strong&gt; Reverse the string using reverse().&lt;br&gt;
&lt;strong&gt;Step 04:&lt;/strong&gt; Join the string using join().&lt;br&gt;
&lt;strong&gt;Step 05:&lt;/strong&gt; Convert the string into number using Number().&lt;br&gt;
&lt;strong&gt;Step 06:&lt;/strong&gt; Check whether the number is equal to the parameter x or not.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/**
 * @param {number} x
 * @return {boolean}
 */
var isPalindrome = function (x) {
    return x === Number(x.toString().split("").reverse().join(""));
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want me to publish more posts like this, Buy me a coffee.&lt;/p&gt;

&lt;p&gt;👉 YouTube Channel Link: &lt;a href="https://www.youtube.com/channel/UCW_09Nbobf4URLkAlEo84sw"&gt;https://www.youtube.com/channel/UCW_09Nbobf4URLkAlEo84sw&lt;/a&gt;&lt;br&gt;
👉 PlayList Link: &lt;a href="https://youtube.com/playlist?list=PLUnklBXn8NSefCpBaLe39mds6dQx-tDDD"&gt;https://youtube.com/playlist?list=PLUnklBXn8NSefCpBaLe39mds6dQx-tDDD&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 Connect with me (LinkedIn): &lt;a href="https://www.linkedin.com/in/abusalehfaysal"&gt;https://www.linkedin.com/in/abusalehfaysal&lt;/a&gt;&lt;br&gt;
👉 Follow our LinkedIn Page:&lt;br&gt;
👉 Like our Facebook page: &lt;a href="https://www.facebook.com/thebacklogprogrammer/"&gt;https://www.facebook.com/thebacklogprogrammer/&lt;/a&gt;&lt;br&gt;
👉 Join our community (Facebook group): &lt;a href="https://www.facebook.com/groups/5500588936676942/"&gt;https://www.facebook.com/groups/5500588936676942/&lt;/a&gt;&lt;br&gt;
👉 Follow me at: &lt;a href="https://www.facebook.com/AbuSalehFaysal10"&gt;https://www.facebook.com/AbuSalehFaysal10&lt;/a&gt;&lt;br&gt;
👉 Twitter: &lt;a href="https://twitter.com/AbuSalehFaysal"&gt;https://twitter.com/AbuSalehFaysal&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 Abu Saleh Faysal’s Blog: &lt;a href="https://abusalehfaysal.hashnode.dev/"&gt;https://abusalehfaysal.hashnode.dev/&lt;/a&gt;&lt;br&gt;
👉 Hasnode: &lt;a href="https://hashnode.com/@AbuSalehFaysal"&gt;https://hashnode.com/@AbuSalehFaysal&lt;/a&gt;&lt;br&gt;
👉 Dev Community: &lt;a href="https://dev.to/abusalehfaysal"&gt;https://dev.to/abusalehfaysal&lt;/a&gt;&lt;br&gt;
👉 freeCodeCamp: &lt;a href="https://www.freecodecamp.org/abusalehfaysal"&gt;https://www.freecodecamp.org/abusalehfaysal&lt;/a&gt;&lt;br&gt;
👉 Medium: &lt;a href="https://abusalehfaysal.medium.com/"&gt;https://abusalehfaysal.medium.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 GitHub: &lt;a href="https://github.com/AbuSalehFaysal"&gt;https://github.com/AbuSalehFaysal&lt;/a&gt;&lt;br&gt;
👉 GitLab: &lt;a href="https://gitlab.com/AbuSalehFaysal"&gt;https://gitlab.com/AbuSalehFaysal&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>leetcode</category>
      <category>programming</category>
    </item>
    <item>
      <title>1. Two Sum - Leetcode - JavaScript Solution using HashMap - by Abu Saleh Faysal</title>
      <dc:creator>Abu Saleh Faysal</dc:creator>
      <pubDate>Sun, 13 Nov 2022 18:45:25 +0000</pubDate>
      <link>https://dev.to/abusalehfaysal/1-two-sum-leetcode-javascript-solution-using-hashmap-by-abu-saleh-faysal-4fml</link>
      <guid>https://dev.to/abusalehfaysal/1-two-sum-leetcode-javascript-solution-using-hashmap-by-abu-saleh-faysal-4fml</guid>
      <description>&lt;p&gt;I previously solved this problem using two for loops. However, that was not a very efficient way to solve this problem. So, this time I solved this problem using HashMap.&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Step 01:&lt;/strong&gt; Hashmap is a set of key, value pairs. I declared a variable which is an empty hashmap.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Step 02: *&lt;/em&gt; Using a for loop, iterate the whole array and find out the needed number to meet the target (for each individual number) using this equation: needed number = target - individual number.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 03:&lt;/strong&gt; Check if the hashmap contains the needed number or not, if it contains the needed number, then we simply return the needed number index and the index of that particular array element that gave us the needed number. If it does not meet the condition then, I simply store the number and the index in the hashmap.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/**
 * @param {number[]} nums
 * @param {number} target
 * @return {number[]}
 */
var twoSum = function(nums, target) {
    let hashMap = new Map();

    for(let i = 0; i &amp;lt; nums.length; i++) {
        let neededNumber = target - nums[i];

        if(hashMap.has(neededNumber)) {
            return [i, hashMap.get(neededNumber)];
        } 
        hashMap.set(nums[i], i);

    }
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want me to publish more posts like this, &lt;a href="https://www.buymeacoffee.com/abusalehfaysal"&gt;Buy me a coffee&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;👉 YouTube Channel Link: &lt;a href="https://www.youtube.com/channel/UCW_09Nbobf4URLkAlEo84sw"&gt;https://www.youtube.com/channel/UCW_09Nbobf4URLkAlEo84sw&lt;/a&gt;&lt;br&gt;
👉 PlayList Link: &lt;a href="https://youtube.com/playlist?list=PLUnklBXn8NSefCpBaLe39mds6dQx-tDDD"&gt;https://youtube.com/playlist?list=PLUnklBXn8NSefCpBaLe39mds6dQx-tDDD&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 Connect with me (LinkedIn): &lt;a href="https://www.linkedin.com/in/abusalehfaysal"&gt;https://www.linkedin.com/in/abusalehfaysal&lt;/a&gt;&lt;br&gt;
👉 Follow our LinkedIn Page: &lt;br&gt;
👉 Like our Facebook page: &lt;a href="https://www.facebook.com/thebacklogprogrammer/"&gt;https://www.facebook.com/thebacklogprogrammer/&lt;/a&gt;&lt;br&gt;
👉 Join our community (Facebook group): &lt;a href="https://www.facebook.com/groups/5500588936676942/"&gt;https://www.facebook.com/groups/5500588936676942/&lt;/a&gt;&lt;br&gt;
👉 Follow me at: &lt;a href="https://www.facebook.com/AbuSalehFaysal10"&gt;https://www.facebook.com/AbuSalehFaysal10&lt;/a&gt;&lt;br&gt;
👉 Twitter: &lt;a href="https://twitter.com/AbuSalehFaysal"&gt;https://twitter.com/AbuSalehFaysal&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 Abu Saleh Faysal’s Blog: &lt;a href="https://abusalehfaysal.hashnode.dev/"&gt;https://abusalehfaysal.hashnode.dev/&lt;/a&gt;&lt;br&gt;
👉 Hasnode: &lt;a href="https://hashnode.com/@AbuSalehFaysal"&gt;https://hashnode.com/@AbuSalehFaysal&lt;/a&gt;&lt;br&gt;
👉 Dev Community: &lt;a href="https://dev.to/abusalehfaysal"&gt;https://dev.to/abusalehfaysal&lt;/a&gt;&lt;br&gt;
👉 freeCodeCamp: &lt;a href="https://www.freecodecamp.org/abusalehfaysal"&gt;https://www.freecodecamp.org/abusalehfaysal&lt;/a&gt;&lt;br&gt;
👉 Medium: &lt;a href="https://abusalehfaysal.medium.com/"&gt;https://abusalehfaysal.medium.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 GitHub: &lt;a href="https://github.com/AbuSalehFaysal"&gt;https://github.com/AbuSalehFaysal&lt;/a&gt;&lt;br&gt;
👉 GitLab: &lt;a href="https://gitlab.com/AbuSalehFaysal"&gt;https://gitlab.com/AbuSalehFaysal&lt;/a&gt;&lt;/p&gt;

</description>
      <category>leetcode</category>
      <category>programming</category>
      <category>javascript</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>1. Two Sum - Leeetcode - JavaScript Solution using for loops - by Abu Saleh Faysal</title>
      <dc:creator>Abu Saleh Faysal</dc:creator>
      <pubDate>Wed, 09 Nov 2022 14:35:54 +0000</pubDate>
      <link>https://dev.to/abusalehfaysal/1-two-sum-leeetcode-javascript-solution-n14</link>
      <guid>https://dev.to/abusalehfaysal/1-two-sum-leeetcode-javascript-solution-n14</guid>
      <description>&lt;h2&gt;
  
  
  1. Two Sum
&lt;/h2&gt;

&lt;p&gt;Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.&lt;/p&gt;

&lt;p&gt;You may assume that each input would have exactly one solution, and you may not use the same element twice.&lt;/p&gt;

&lt;p&gt;You can return the answer in any order.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;br&gt;
Input: nums = [2,7,11,15], target = 9&lt;br&gt;
Output: [0,1]&lt;br&gt;
Explanation: Because nums[0] + nums[1] == 9, we return [0, 1].&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8j9uBoVd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tt4p5qome1ic6atin400.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8j9uBoVd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tt4p5qome1ic6atin400.png" alt="Image description" width="880" height="688"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 01:&lt;/strong&gt; I simply iterate the array using for loops, and inside the for loops I iterate the array again but this time start the index with the next position(compare to the first iteration)&lt;br&gt;
&lt;strong&gt;Step 02:&lt;/strong&gt; In this way, I got pair of numbers from the array and check if the total of the pair is equal to the target number or not.&lt;br&gt;
&lt;strong&gt;Step 03:&lt;/strong&gt; If the total value is equal to the target, I simply return the index numbers.&lt;/p&gt;

&lt;p&gt;If you want me to publish more posts like this, Buy me a coffee.&lt;/p&gt;

&lt;p&gt;👉 YouTube Channel Link: &lt;a href="https://www.youtube.com/channel/UCW_09Nbobf4URLkAlEo84sw"&gt;https://www.youtube.com/channel/UCW_09Nbobf4URLkAlEo84sw&lt;/a&gt;&lt;br&gt;
👉 PlayList Link: &lt;a href="https://youtube.com/playlist?list=PLUnklBXn8NSefCpBaLe39mds6dQx-tDDD"&gt;https://youtube.com/playlist?list=PLUnklBXn8NSefCpBaLe39mds6dQx-tDDD&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 Connect with me (LinkedIn): &lt;a href="https://www.linkedin.com/in/abusalehfaysal"&gt;https://www.linkedin.com/in/abusalehfaysal&lt;/a&gt;&lt;br&gt;
👉 Follow our LinkedIn Page:&lt;br&gt;
👉 Like our Facebook page: &lt;a href="https://www.facebook.com/thebacklogprogrammer/"&gt;https://www.facebook.com/thebacklogprogrammer/&lt;/a&gt;&lt;br&gt;
👉 Join our community (Facebook group): &lt;a href="https://www.facebook.com/groups/5500588936676942/"&gt;https://www.facebook.com/groups/5500588936676942/&lt;/a&gt;&lt;br&gt;
👉 Follow me at: &lt;a href="https://www.facebook.com/AbuSalehFaysal10"&gt;https://www.facebook.com/AbuSalehFaysal10&lt;/a&gt;&lt;br&gt;
👉 Twitter: &lt;a href="https://twitter.com/AbuSalehFaysal"&gt;https://twitter.com/AbuSalehFaysal&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 Abu Saleh Faysal’s Blog: &lt;a href="https://abusalehfaysal.hashnode.dev/"&gt;https://abusalehfaysal.hashnode.dev/&lt;/a&gt;&lt;br&gt;
👉 Hasnode: &lt;a href="https://hashnode.com/@AbuSalehFaysal"&gt;https://hashnode.com/@AbuSalehFaysal&lt;/a&gt;&lt;br&gt;
👉 Dev Community: &lt;a href="https://dev.to/abusalehfaysal"&gt;https://dev.to/abusalehfaysal&lt;/a&gt;&lt;br&gt;
👉 freeCodeCamp: &lt;a href="https://www.freecodecamp.org/abusalehfaysal"&gt;https://www.freecodecamp.org/abusalehfaysal&lt;/a&gt;&lt;br&gt;
👉 Medium: &lt;a href="https://abusalehfaysal.medium.com/"&gt;https://abusalehfaysal.medium.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 GitHub: &lt;a href="https://github.com/AbuSalehFaysal"&gt;https://github.com/AbuSalehFaysal&lt;/a&gt;&lt;br&gt;
👉 GitLab: &lt;a href="https://gitlab.com/AbuSalehFaysal"&gt;https://gitlab.com/AbuSalehFaysal&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>leetcode</category>
    </item>
    <item>
      <title>HackerRank — Problem Solving — JavaScript — Staircase</title>
      <dc:creator>Abu Saleh Faysal</dc:creator>
      <pubDate>Thu, 28 Jul 2022 21:01:03 +0000</pubDate>
      <link>https://dev.to/abusalehfaysal/hackerrank-problem-solving-javascript-staircase-3k66</link>
      <guid>https://dev.to/abusalehfaysal/hackerrank-problem-solving-javascript-staircase-3k66</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1IwJF7MM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/62654nxw8z9swbu5aveb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1IwJF7MM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/62654nxw8z9swbu5aveb.png" alt="Image description" width="880" height="1236"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Its base and height are both equal to n. It is drawn using # symbols and spaces. The last line is not preceded by any spaces. We have to write a program that prints a staircase of size n.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VySXq12d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uu49652j0w8hqa88uam7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VySXq12d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uu49652j0w8hqa88uam7.png" alt="Image description" width="880" height="422"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;br&gt;
Step 01: Iterate a for loop.&lt;br&gt;
Step 02: While iterating the loop we need to print the blank spaces and the "#".&lt;br&gt;
Step 03: While printing we need to repeat the blank spaces by n-i number and "#" by the i number of times so that from top to bottom, in each row the blank spaces reduce and the number of "#" increases and it turns into a staircase shape. &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>hackerrank</category>
      <category>problemsolving</category>
      <category>coding</category>
    </item>
    <item>
      <title>HackerRank — Problem Solving — JavaScript — Plus Minus</title>
      <dc:creator>Abu Saleh Faysal</dc:creator>
      <pubDate>Mon, 25 Jul 2022 21:34:00 +0000</pubDate>
      <link>https://dev.to/abusalehfaysal/hackerrank-problem-solving-javascript-plus-minus-16m4</link>
      <guid>https://dev.to/abusalehfaysal/hackerrank-problem-solving-javascript-plus-minus-16m4</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqfl0utggpa1h099zac0q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqfl0utggpa1h099zac0q.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Given an array of integers, calculate the ratios of its elements that are positive, negative, and zero. Print the decimal value of each fraction on a new line with  places after the decimal.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwh2urbwadxiq1j5kedd8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwh2urbwadxiq1j5kedd8.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;br&gt;
Step 01: Take three variables named "positive", "negative" and "zero. Store initial value as zero(0).&lt;br&gt;
Step 02: Iterate a for loop through the given array.&lt;br&gt;
Step 03: While iterating the array we have to count the positive, negative and zero values.&lt;br&gt;
Step 04: Calculate the ratios by dividing with the array length.&lt;br&gt;
Step 05: Print the results.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>problemsolving</category>
      <category>hackerrank</category>
      <category>coding</category>
    </item>
    <item>
      <title>HackerRank — Problem Solving — JavaScript — Diagonal Difference</title>
      <dc:creator>Abu Saleh Faysal</dc:creator>
      <pubDate>Mon, 25 Jul 2022 21:17:00 +0000</pubDate>
      <link>https://dev.to/abusalehfaysal/hackerrank-problem-solving-javascript-diagonal-difference-2e35</link>
      <guid>https://dev.to/abusalehfaysal/hackerrank-problem-solving-javascript-diagonal-difference-2e35</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjwrxcc11oxir91vqsf33.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjwrxcc11oxir91vqsf33.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Task is to find the absolute difference between the sums of the matrix's two diagonals as a single integer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5or5tdqbl44h7tjb3slm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5or5tdqbl44h7tjb3slm.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Step 01:&lt;/strong&gt; Take two variables named "diagonal1" and "diagonal2". Store initial value as zero(0).&lt;br&gt;
&lt;strong&gt;Step 02:&lt;/strong&gt; Iterate a for loop through the given array.&lt;br&gt;
&lt;strong&gt;Step 03:&lt;/strong&gt; While iterating the array we have to take the array matrix's row and column as index i to, then add the value to diagonal1.&lt;br&gt;
&lt;strong&gt;Step 04:&lt;/strong&gt; Reversing the second dimension of array to calculate secondary diagonal.&lt;br&gt;
&lt;strong&gt;Step 05:&lt;/strong&gt; Return absolute difference value.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>coding</category>
      <category>problemsolving</category>
    </item>
    <item>
      <title>HackerRank — Problem Solving — JavaScript — A Very Big Sum</title>
      <dc:creator>Abu Saleh Faysal</dc:creator>
      <pubDate>Thu, 23 Jun 2022 14:02:34 +0000</pubDate>
      <link>https://dev.to/abusalehfaysal/hackerrank-problem-solving-javascript-a-very-big-sum-4h64</link>
      <guid>https://dev.to/abusalehfaysal/hackerrank-problem-solving-javascript-a-very-big-sum-4h64</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiz05l9wqeofneqs57e60.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiz05l9wqeofneqs57e60.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The task is to find and print the sum of the elements in an array, keeping in mind that some of those integers may be quite large.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8xaw9bzc4eb82rbwwjms.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8xaw9bzc4eb82rbwwjms.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 01:&lt;/strong&gt; Take one variable named "sum" and store an initial value as zero(0).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 02:&lt;/strong&gt; Iterate a for loop through the given array.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 03:&lt;/strong&gt; While iterating the array we are going to add the array element with the variable named "sum".&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 04:&lt;/strong&gt; Return the overall summation at the very end after iterating the whole array.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>problemsolving</category>
      <category>hackerrank</category>
    </item>
    <item>
      <title>HackerRank — Problem Solving — JavaScript — Compare the Triplets</title>
      <dc:creator>Abu Saleh Faysal</dc:creator>
      <pubDate>Mon, 23 May 2022 15:48:22 +0000</pubDate>
      <link>https://dev.to/abusalehfaysal/hackerrank-problem-solving-javascript-compare-the-triplets-294h</link>
      <guid>https://dev.to/abusalehfaysal/hackerrank-problem-solving-javascript-compare-the-triplets-294h</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yx9nSbZR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/csrlprdp6mciku45iy3q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yx9nSbZR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/csrlprdp6mciku45iy3q.png" alt="Image description" width="880" height="1894"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The task is to find their comparison points by comparing a[0] with b[0], a[1] with b[1], and a[2] with b[2].&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;If a[i] &amp;gt; b[i], then Alice is awarded 1 point.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If a[i] &amp;lt; b[i], then Bob is awarded 1 point.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If a[i] = b[i], then neither person receives a point.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Comparison points is the total points a person earned.Given a and b, determine their respective comparison points.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wZmmGtzI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g3tjro9ar8r0gvobeoqf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wZmmGtzI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g3tjro9ar8r0gvobeoqf.png" alt="Image description" width="880" height="859"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Step 01:&lt;/strong&gt; Take two variables named "first" and "second". Then store an initial value as 0 for both of them.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Step 02:&lt;/strong&gt; Iterate a for loop through the given array(the array can be the first one or the second one, as long as they are equal in length, we can use any of them).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Step 03:&lt;/strong&gt; If the element of first array is greater the second array, we will increment the "first" variable by 1. However, if the element of second array is greater the first array, we will increment the "second" variable by 1. Lastly, in case the the elements of both array contain the same value, we will not make any changes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Step 04:&lt;/strong&gt; Return the "first" and "second" variables in the form of an array where first element is the "first" variable and the second element is the "second" variable.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>problemsolving</category>
      <category>hackerrank</category>
    </item>
    <item>
      <title>HackerRank — Problem Solving — JavaScript — Simple Array Sum</title>
      <dc:creator>Abu Saleh Faysal</dc:creator>
      <pubDate>Tue, 19 Apr 2022 16:06:10 +0000</pubDate>
      <link>https://dev.to/abusalehfaysal/hackerrank-problem-solving-javascript-simple-array-sum-4g7p</link>
      <guid>https://dev.to/abusalehfaysal/hackerrank-problem-solving-javascript-simple-array-sum-4g7p</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0t384m0rwyzrzsy2wroc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0t384m0rwyzrzsy2wroc.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Given an array of integers, find the sum of its elements. For instance, if the array=[10,20,30], then it will return 10+20+30 = 60.&lt;/p&gt;

&lt;p&gt;Solution:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbdolex2wh18xz7siwnjk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbdolex2wh18xz7siwnjk.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Explanation: &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Step 01:&lt;/strong&gt; Take a variable named sum and store an initial value as 0.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Step 02:&lt;/strong&gt; Iterate a for loop through the given array.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Step 03:&lt;/strong&gt; Add up each array element in the sum variable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;-Step 04:&lt;/strong&gt; Return the sum variable after adding all the array element.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>problemsolving</category>
      <category>hackerrank</category>
    </item>
  </channel>
</rss>
