<?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: Dhruvin</title>
    <description>The latest articles on DEV Community by Dhruvin (@dhruvindev).</description>
    <link>https://dev.to/dhruvindev</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%2F493667%2F9d6cb910-187f-4197-be7b-81ac89c5c227.png</url>
      <title>DEV Community: Dhruvin</title>
      <link>https://dev.to/dhruvindev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dhruvindev"/>
    <language>en</language>
    <item>
      <title>Breaking Down Success: What Separates Top Developers from the Rest</title>
      <dc:creator>Dhruvin</dc:creator>
      <pubDate>Thu, 27 Apr 2023 05:45:42 +0000</pubDate>
      <link>https://dev.to/dhruvindev/breaking-down-success-what-separates-top-developers-from-the-rest-210j</link>
      <guid>https://dev.to/dhruvindev/breaking-down-success-what-separates-top-developers-from-the-rest-210j</guid>
      <description>&lt;p&gt;Hey there, fellow developers! Did you know that there are over &lt;strong&gt;28.7 million&lt;/strong&gt; of us out there? That's a whole lot of coding going on!&lt;/p&gt;

&lt;p&gt;But what sets the most successful developers apart from the rest of the pack? It's not just about being a programming whiz or having a photographic memory for code. Nope, it's something much simpler than that.&lt;/p&gt;

&lt;p&gt;First off, you've got to &lt;strong&gt;get comfortable with being uncomfortable&lt;/strong&gt; . As a software engineer, you're expected to solve problems even if you don't have all the answers. That means stepping outside of your comfort zone and tackling new challenges, even if it feels like you're in over your head. And let's be real, that happens to the best of us. But don't freak out! Take a deep breath, keep a cool head, and remember that this is an opportunity to grow.&lt;/p&gt;

&lt;p&gt;Next up, &lt;strong&gt;check your ego at the door&lt;/strong&gt; . Yes, you might be a hotshot programmer with mad skills, but that doesn't mean you're too good for the basics. Don't turn up your nose at simple projects or tasks, because they're essential for building a solid foundation. So swallow your pride and dive into those beginner tutorials, because you never know what new insights you might gain.&lt;/p&gt;

&lt;p&gt;And finally, remember that &lt;strong&gt;programming can never be mastered&lt;/strong&gt; . That might sound intimidating, but hear me out. Instead of trying to master every single language and concept out there, focus on building things and continuously improving. That's right, it's all about that growth mindset. Don't get bogged down with the idea of being a "master" - just focus on being a better developer than you were yesterday.&lt;/p&gt;

&lt;p&gt;So there you have it, folks. The secret to success as a developer isn't some mythical ability to memorize code or churn out apps at lightning speed. It's about being willing to learn, grow, and adapt - even when things get uncomfortable. Now get out there and start coding!&lt;/p&gt;

&lt;p&gt;Follow me on &lt;a href="https://www.instagram.com/writegoodcode/"&gt;Instagram&lt;/a&gt; for more awesome content.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>productivity</category>
      <category>codenewbie</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Crushing Job Interviews(DSA) - Sorted Squared Arrays</title>
      <dc:creator>Dhruvin</dc:creator>
      <pubDate>Fri, 24 Jun 2022 07:15:06 +0000</pubDate>
      <link>https://dev.to/dhruvindev/crushing-job-interviewsdsa-sorted-squared-arrays-1np9</link>
      <guid>https://dev.to/dhruvindev/crushing-job-interviewsdsa-sorted-squared-arrays-1np9</guid>
      <description>&lt;h3&gt;
  
  
  The Question
&lt;/h3&gt;

&lt;h5&gt;
  
  
  Difficulty: &lt;strong&gt;Kind of Medium&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;Write a function that takes in a non-empty array of integers that are sorted in ascending order and returns a new array of the same length with the squares of the original integers also sorted in ascending order.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sample Input&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;array&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Sample Output&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;36&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;64&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;81&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Optimal Space &amp;amp; Time Complexity:
&lt;/h5&gt;

&lt;p&gt;O(n) time | O(n) space - where n is the length of the input array&lt;/p&gt;

&lt;h3&gt;
  
  
  The Thinking
&lt;/h3&gt;

&lt;p&gt;It's important to ask your interviewer that can you mutate the original array given to you or you have to create a duplicate array.&lt;/p&gt;

&lt;p&gt;So there are two way's to solve this, first is :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Iterate through the array&lt;/li&gt;
&lt;li&gt;Square each number, and&lt;/li&gt;
&lt;li&gt;Add to new array&lt;/li&gt;
&lt;li&gt;Sort the array&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This solution is simple but the we can do better.&lt;/p&gt;

&lt;p&gt;In the second solution, we use pointers.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;P.S: Pointers in arrays context are used to keep track of the position while iterating through it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So what we will do is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Iterate through the  array,&lt;/li&gt;
&lt;li&gt;Keep track of the first and the last position of the array using pointers,&lt;/li&gt;
&lt;li&gt;Compare the absolute value of the items the pointers are pointing at.&lt;/li&gt;
&lt;li&gt;IF the first index value is greater, then place that value at the index we are iterating through in the duplicate array we created and increment the first pointer by 1.&lt;/li&gt;
&lt;li&gt;ELSE, place the other pointer arrays value at the current index we are iterating through and decrease the second pointer by 1.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sounds Confusing ? Well it is, but I'm sure you'll get a better understanding by looking at code once. I'll not be writing down the first solutions since it's very simple and I believe you can easily come up with the solutions. But if you still want it, drop down a comment and I'll post it.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Solution (2nd one)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;sortedSquaredArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;toReturn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[...&lt;/span&gt;&lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;smallerValueIdx&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;largerValueIdx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;idx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;idx&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;idx&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;smallerVal&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;smallerValueIdx&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;largeVal&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;largerValueIdx&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;smallerVal&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;largeVal&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;toReturn&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;idx&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;smallerVal&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;smallerVal&lt;/span&gt;
      &lt;span class="nx"&gt;smallerValueIdx&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;toReturn&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;idx&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;largeVal&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;largeVal&lt;/span&gt;
      &lt;span class="nx"&gt;largerValueIdx&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;toReturn&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Got any doubt's ? Got a better solutions ? Drop a comment below and let's start a discussion.&lt;/p&gt;

&lt;p&gt;Follow me on instagram for more awesome content on coding: &lt;a href="https://www.instagram.com/dhruvindev"&gt;https://www.instagram.com/dhruvindev&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>webdev</category>
      <category>tutorial</category>
      <category>devops</category>
    </item>
    <item>
      <title>Crushing Job Interviews(DSA) - Two Number Sum</title>
      <dc:creator>Dhruvin</dc:creator>
      <pubDate>Thu, 23 Jun 2022 07:29:24 +0000</pubDate>
      <link>https://dev.to/dhruvindev/crushing-job-interviewsdsa-two-number-sum-2joa</link>
      <guid>https://dev.to/dhruvindev/crushing-job-interviewsdsa-two-number-sum-2joa</guid>
      <description>&lt;h3&gt;
  
  
  The Question
&lt;/h3&gt;

&lt;h5&gt;
  
  
  Difficulty: &lt;strong&gt;Easy&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;Write a function that takes in a non-empty array of distinct integers and an integer representing a target sum. If any two numbers in the input array sum up to the target sum, the function should return them in an array, in any order. If no two numbers sum up to the target sum, the function should return an empty array.&lt;/p&gt;

&lt;p&gt;Note that the target sum has to be obtained by summing two different integers in the array; you can't add a single integer to itself in order to obtain the target sum.&lt;/p&gt;

&lt;p&gt;You can assume that there will be at most one pair of numbers summing up to the target sum.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sample Input&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;array&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="nx"&gt;targetSum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Sample Output&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="c1"&gt;// the numbers could be in reverse order&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Optimal Space &amp;amp; Time Complexity:
&lt;/h5&gt;

&lt;p&gt;O(n) time | O(n) space - where n is the length of the input array&lt;/p&gt;

&lt;h3&gt;
  
  
  The Thinking
&lt;/h3&gt;

&lt;p&gt;If you paid attention to the boring maths professor's class, you might be able to come up with this solutions very easily.&lt;/p&gt;

&lt;p&gt;So lets say&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// 10 is the target sum&lt;/span&gt;
&lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;
&lt;span class="c1"&gt;// so&lt;/span&gt;
&lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;P.S: Hashmap is just a object in javascript or dictionary in python.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So now what we do is, we create a hashmap and iterate through the array that's given to us. Then we:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;check if the hash has y ie &lt;code&gt;10 - x&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;if the value is there, then we return the array, since we have both x and y&lt;/li&gt;
&lt;li&gt;if not then we add that num to the hashmap&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Solution
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;twoNumberSum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;targetSum&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;nums&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt; &lt;span class="c1"&gt;// this is the hashmap&lt;/span&gt;

  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;targetSum&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;targetSum&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="nx"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Got any doubt's ? Got a better solutions ? Drop a comment below and let's start a discussion.&lt;/p&gt;

&lt;p&gt;Follow me on instagram for more awesome content on coding: &lt;a href="https://www.instagram.com/dhruvindev"&gt;https://www.instagram.com/dhruvindev&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>algorithms</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>What can programmers learn from predators?</title>
      <dc:creator>Dhruvin</dc:creator>
      <pubDate>Fri, 02 Apr 2021 04:59:06 +0000</pubDate>
      <link>https://dev.to/dhruvindev/what-can-programmers-learn-from-predators-38g7</link>
      <guid>https://dev.to/dhruvindev/what-can-programmers-learn-from-predators-38g7</guid>
      <description>&lt;p&gt;So what can we programmers learn from predators? First, let me give you a bit of context so you know what I mean by predators. A predator is an organism that eats another organism. Thas the literal definition from google. The predators that I'm talking about are from the movie &lt;code&gt;Predators&lt;/code&gt;. In the movie, a group of mercenaries and militia people find themselves on an alien planet in a game in which they are hunted and they have to survive. The creatures are savage and quite technologically advanced. They have rockers launchers, lasers, and thermal cameras mounted on their body. They can also become invisible to &lt;strong&gt;hunt&lt;/strong&gt; their prey. When I was watching the movie a thought struck me. Being so technologically advanced why the f*CK do they have to hunt, why not create a simple farm? The obvious answer is, &lt;code&gt;it's just a movie!&lt;/code&gt;, but I think it's deeper than that. Let me explain. &lt;/p&gt;

&lt;p&gt;Predators being so technologically advanced didn't abandon their core nature ie hunting. Instead, they created tools that made that process more efficient ie creating tools and weapons.&lt;/p&gt;

&lt;p&gt;What can we learn from them? Dont abandon your nature. We, humans also have a core nature. Humans are evolved from millions of years to survive. Living in a modern society, survival isn't a problem. I am not asking you to become a complete savage and go to some forest and become a Tarzan. Instead, try to leverage your core nature. How to do that in the programming world? &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Do any form of exercise: Humans were completely fierce in the stone age. They could walk for tens of kilometers without even taking a break. They could take down a lion with just sharp stones. Our body has evolved to become more and more efficient and powerful. At least do some form of an exercise to bring out the beast in you. Believe me you will feel completely different and have a ton of energy. &lt;/li&gt;
&lt;li&gt;&lt;p&gt;Spend time in nature: For thousands of years, humans have lived in forests. Spending time in nature is relaxing. Instead of playing video games in your free time, sometimes go for a walk in nature. You can also place a plant on your desk. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;anything you can think of that humans did thousands of years before.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you enjoyed the read comment your thoughts below and drop a like. &lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>productivity</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Number one skill you need to go from a good dev to a great developer</title>
      <dc:creator>Dhruvin</dc:creator>
      <pubDate>Sat, 13 Feb 2021 12:20:46 +0000</pubDate>
      <link>https://dev.to/dhruvindev/number-one-skill-you-need-to-go-from-a-good-dev-to-a-great-developer-1c5g</link>
      <guid>https://dev.to/dhruvindev/number-one-skill-you-need-to-go-from-a-good-dev-to-a-great-developer-1c5g</guid>
      <description>&lt;p&gt;Hey there 🤟, today let's talk about what is the most logical and practical skill you need to be a great developer. Here are some of the things I found on the web. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Curiosity&lt;/strong&gt;:  the will to explore more aka  WANDERLUST. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Technical Skills&lt;/strong&gt;: if you don't have then you can always learn them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Love of learning&lt;/strong&gt;: where's Php now? if you don't learn your gonna be in trouble.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Communication skills&lt;/strong&gt;: a must if you wanna do anything in life.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Positive attitude&lt;/strong&gt;: if you don't have this you won't last long in this industry.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Good time and task management&lt;/strong&gt;: it's a superpower to have this, complete one week of work in one day.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Good team player&lt;/strong&gt;: don't play blame games, take ownership&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are pretty obvious things that we have been hearing for ages. So which is the number one skill you need? &lt;strong&gt;It's patiently reading stuff online&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;How ? lemme explain. Throughout your software dev journey, no matter how many jobs you change, no matter how many startups you work in, no matter what you do you cannot ignore one thing and that is bugs. You cannot ignore these no matter what, even if you code in HTML  you will have bugs. Things will not work as they are supposed to work. Something unexpected will definitely happen and to make it work you will use Google (or Bing if you're a complete newbie).  So how will you solve that bug?  Googling, reading articles online, copy-pasting code from stack overflow, reading documentation, etc. If you patiently read each and everything related to your bug you will grow exponentially, although it will take time to read stuff, but it is worth it. It will give you complete insights on what was the mistake that you're making unless it was a typo. It is the number one thing that has helped me grow and will definitely help you too &lt;/p&gt;

&lt;p&gt;If you liked what you just read consider liking the post or leaving a comment or maybe do both xD.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>webdev</category>
      <category>productivity</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Npx in React ... A typo or something that actually makes sense</title>
      <dc:creator>Dhruvin</dc:creator>
      <pubDate>Mon, 01 Feb 2021 21:10:44 +0000</pubDate>
      <link>https://dev.to/dhruvindev/npx-in-react-a-typo-or-something-that-actually-makes-sense-11ne</link>
      <guid>https://dev.to/dhruvindev/npx-in-react-a-typo-or-something-that-actually-makes-sense-11ne</guid>
      <description>&lt;p&gt;Npm as we all know is a package manager for node. It is a tool that we use to install packages locally on our machine. It is a default package manager for node. If you wanna run the package that you just installed then you gotta specify that package in your package.json and install it locally and then do &lt;code&gt;npm run the-package-you-just-installed&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;But when initializing a new react project using create-react-app we do &lt;code&gt;npx create-react-app&lt;/code&gt;. why is that? First, let's understand the problem we're trying to solve. So let's just forget npx and all that and let's do it using npm. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ok so first we gotta create the package.json file. So fire up your cmd and type &lt;code&gt;npm init -y&lt;/code&gt;. -y will generate the package.json file without asking any questions. &lt;/li&gt;
&lt;li&gt;next step is to &lt;strong&gt;install the create-react-app&lt;/strong&gt; so type &lt;code&gt;npm install create-react-app&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;so we just installed create-react-app and now we run the package to create our react project. to do that we gotta modify the package.json file and tell npm the command to execute. Open up package.json in your favorite code editor and in the scripts object create a new key and name it react-app (you can name it anything you want). then store the string name "create-react-app" in that key. 
&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%2Fi%2Fh94tedybpfzujc55r05u.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;li&gt;finally go to your terminal again and type &lt;code&gt;npm run react-app [your app name]&lt;/code&gt;. after doing this your react project should be created. uuuf such a long process. 
&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%2Fi%2Fp4y8ys0ip6f6udeeq3d4.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;lets make it much much much simpler ...&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;so now instead of npm just type &lt;code&gt;npx create-react-app [app name]&lt;/code&gt;. this will skip all the previous steps and just create your project directly. so easy right xd. so what's happening here? &lt;br&gt;
well, npx just executed the package specified without ever installing it locally. while npm installed the package locally npx just executed the package without ever installing it. so the conclusion is &lt;strong&gt;npx makes sense&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Drop a comment or like the post or do both if you enjoyed the read. Follow me for more such content. &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>react</category>
      <category>webdev</category>
    </item>
    <item>
      <title>ssh. is it secure or just a bluff ? Understand how it works .</title>
      <dc:creator>Dhruvin</dc:creator>
      <pubDate>Sat, 23 Jan 2021 09:57:32 +0000</pubDate>
      <link>https://dev.to/dhruvindev/ssh-is-it-secure-or-just-a-bluff-understand-how-it-works-437a</link>
      <guid>https://dev.to/dhruvindev/ssh-is-it-secure-or-just-a-bluff-understand-how-it-works-437a</guid>
      <description>&lt;p&gt;If you're a &lt;strong&gt;newbie&lt;/strong&gt; who doesn't understand what ssh is on GitHub or someone whos just starting out in computer science who doesn't understand ssh or doesn't know what it is, this is it, after reading this you'll understand it. &lt;br&gt;
So first let's understand what do you exactly mean by shh and then discuss how it works. &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What is ssh?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Every heard of HTTP, HTTPS, FTP? These are different protocols that the web used . A protocol is a simple set of rules that tells how should two computers interact with each other, how should they exchange information.&lt;br&gt;&lt;br&gt;
SSh is precisely that. It is a protocol that allows two computers to communicate securely over the internet, it allows users to share files and control remote computers over the internet. Just like a browser communicated with the server, in ssh computers communicate through a shell which is used to talk to the operating system of the computer. One of the best features of ssh is that it used encryption to between the host and the client. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Encryption is a way to hide a piece of data. it is unreadable unless you know how to decrypt it for which you need a key.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;So how does it work?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;ssh breaks data down into a series of packets. Heres how a packet looks like &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%2Fi%2F3dqelbrtjwcv1cjoshat.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%2Fi%2F3dqelbrtjwcv1cjoshat.png" alt="ssh packet img"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Packet length&lt;/strong&gt;: It tells you how big the packet actually is. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Padding amount&lt;/strong&gt;: Padding is random bytes that don't mean anything but are encrypted with the payload to make it harder to decrypt &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Message auth code&lt;/strong&gt;:  it is a code to make sure that the data you receive have not been tampered with. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ssh used three different types of data manipulation technique at various points during transmission. They are &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;symmetrical encryption&lt;/li&gt;
&lt;li&gt;Asymmetrical encryption. &lt;/li&gt;
&lt;li&gt;Hashing&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Symmetrical encryption (the simplest to understand ):
&lt;/h3&gt;

&lt;p&gt;one key can be used to encrypt and decrypt the messages. Both the host and the client have the same key. Both devices use the same key to decrypt the messages they receive and encrypt the messages they send. It is used to prevent the middle man 🕵️‍♂️ from being able to read the data. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;One of the main problems this method has is if a third party is listening during the initial key exchange they would be able to decrypt all the messages.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We use a key exchange algorithm to exchange the keys securely. To implement this algorithm we use asymmetrical encryption. &lt;/p&gt;

&lt;h3&gt;
  
  
  Asymmetric encryption (harder than symmetrical encryption to understand but simp ) :
&lt;/h3&gt;

&lt;p&gt;To prevent the middle man from listening to our keys we use asymmetrical encryption. &lt;br&gt;
Asymmetric encryption is implemented using two keys, &lt;strong&gt;private keys&lt;/strong&gt;, and &lt;strong&gt;public keys&lt;/strong&gt;. They form the key pair.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A message that is encrypted with a public key can be decrypted only through the private key.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A public key can be shared with anyone but the private key should not be shared with anyone for obvious reasons. &lt;br&gt;
Even if the thief party obtains the public key he can't decrypt the message. Ssh uses asymmetrical encryption in a few places such as the key exchange algorithm used to set up the symmetrical encryption. Here's how it's done : &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Both devices generate temporary private and public keys and share their respective public keys &lt;/li&gt;
&lt;li&gt;They then independently generate a new symmetric key they will use to encrypt and decrypt messages. This is done using the Diffie Hellman key exchange. Here's a &lt;a href="https://www.youtube.com/watch?v=NmM9HA2MQGI" rel="noopener noreferrer"&gt;link to a video explaining this&lt;/a&gt;. &lt;/li&gt;
&lt;li&gt;Once a secure symmetric communication has been established, the host using the client's public key to generate a challenge a sends it to the client for authentication. If the client can successfully decrypt the challenge it means that it holds the private key required for the connection, and finally, the ssh session can begin. 
### And finally Hashing : 
It allows you to create a signature or summary of a set of information. It is a one-way process and hashed data is never meant to be decrypted. using the hash function each message that is transmitted must contain something called mac, this is a hash generated from the symmetric key, the packet sequence number, and the message contents that were sent. Using these three elements as input into a hash function, it will generate a string that will not make any sense. Confused? read further. Then this string is sent to the host. Why you ask? well, the host has the same information (the symmetric key, packet sequence number, and the message contents), they can use the same hash function to generate the same hash and then compare the two. Even if the letter is capitalized it will result in a completely new hash string and hence this is how it works.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Comparing two meaningless things to make something meaningful. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Quite cool isn't it. &lt;/p&gt;

&lt;p&gt;I hope this helped you understand what is ssh and why is it used for. Btw this my first post on the dev to platform so if you liked what you just read consider liking the post or leaving a comment or maybe do both xD. &lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>security</category>
      <category>webdev</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
