<?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: Irina</title>
    <description>The latest articles on DEV Community by Irina (@irinakramer).</description>
    <link>https://dev.to/irinakramer</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%2F327401%2F3e7d837f-8bb7-47bc-b2a2-072666c05587.png</url>
      <title>DEV Community: Irina</title>
      <link>https://dev.to/irinakramer</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/irinakramer"/>
    <language>en</language>
    <item>
      <title>Leetcode 118. Pascal's Triangle</title>
      <dc:creator>Irina</dc:creator>
      <pubDate>Sat, 16 Sep 2023 03:12:27 +0000</pubDate>
      <link>https://dev.to/irinakramer/leetcode-118-pascals-triangle-27c7</link>
      <guid>https://dev.to/irinakramer/leetcode-118-pascals-triangle-27c7</guid>
      <description>&lt;p&gt;Hello Dev Community,&lt;br&gt;
I'm posting my solution to the Leetcode problem &lt;a href="https://leetcode.com/problems/pascals-triangle/description/"&gt;#118. Pascal's Triangle&lt;/a&gt; &lt;code&gt;Easy&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Description:&lt;/p&gt;

&lt;p&gt;Given an integer numRows, return the first numRows of Pascal's triangle.&lt;/p&gt;

&lt;p&gt;In Pascal's triangle, each number is the sum of the two numbers directly above it as shown:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IXcGduFt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://upload.wikimedia.org/wikipedia/commons/0/0d/PascalTriangleAnimated2.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IXcGduFt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://upload.wikimedia.org/wikipedia/commons/0/0d/PascalTriangleAnimated2.gif" alt="Pascal's triangle" width="260" height="240"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var generate = function(numRows) {
    let res = []

    for (let i = 0; i &amp;lt; numRows; i++) {
        let arr = new Array(i+1)
        arr[0] = arr[arr.length - 1] = 1

        for (let j = 1; j &amp;lt; arr.length-1; j++) {
            arr[j] = res[i-1][j-1] + res[i-1][j]
        }

        res.push(arr)
    }

    return res
};

console.log(generate(5));
[[1],[1,1],[1,2,1],[1,3,3,1],[1,4,6,4,1]]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Method - Nested loops &lt;br&gt;
Complexity - Time O(n^2) | Space O(n^2). Basically complexity here is the product of height and width of the triangle &lt;code&gt;i * j&lt;/code&gt;, which simplifies to n^2.&lt;/p&gt;

&lt;p&gt;I welcome your comments or suggestions!&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>leetcode</category>
      <category>javascript</category>
      <category>datastructures</category>
    </item>
    <item>
      <title>Leetcode #1299 - Replace Elements with Greatest Element on Right Side</title>
      <dc:creator>Irina</dc:creator>
      <pubDate>Thu, 14 Sep 2023 19:43:11 +0000</pubDate>
      <link>https://dev.to/irinakramer/leetcode-1299-replace-elements-with-greatest-element-on-right-side-5b58</link>
      <guid>https://dev.to/irinakramer/leetcode-1299-replace-elements-with-greatest-element-on-right-side-5b58</guid>
      <description>&lt;p&gt;Hello Dev Community,&lt;br&gt;
I'm posting my solution to the Leetcode problem &lt;a href="https://leetcode.com/problems/replace-elements-with-greatest-element-on-right-side/"&gt;#1299 - Replace Elements with Greatest Element on Right Side&lt;/a&gt; &lt;code&gt;Easy&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Problem description:&lt;/p&gt;

&lt;p&gt;Given an array &lt;code&gt;arr&lt;/code&gt;, replace every element in that array with the greatest element among the elements to its right, and replace the last element with &lt;code&gt;-1&lt;/code&gt;.&lt;br&gt;
After doing so, return the array.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var replaceElements = function (arr) {
    let res = new Array(arr.length);
    let max = 0;
    res[arr.length - 1] = -1;

    for (let i = arr.length - 1; i &amp;gt; 0; i--) {
        max = Math.max(arr[i], max);
        res[i - 1] = max;
    }

    return res;
};

console.log(replaceElements([17, 18, 5, 4, 6, 1])); 
// [ 18, 6, 6, 6, 1, -1 ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Method - Two pointers (i and i-1)&lt;br&gt;
Complexity - Time O(n) | Space O(n)&lt;/p&gt;

&lt;p&gt;Leetcode stats:&lt;br&gt;
Runtime - beats 78.21%&lt;br&gt;
Memory - beats 60.18%&lt;/p&gt;

&lt;p&gt;I welcome your comments or suggestions!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Adding social share tags to your website</title>
      <dc:creator>Irina</dc:creator>
      <pubDate>Fri, 13 Nov 2020 08:46:38 +0000</pubDate>
      <link>https://dev.to/irinakramer/adding-social-share-tags-to-your-website-5dd1</link>
      <guid>https://dev.to/irinakramer/adding-social-share-tags-to-your-website-5dd1</guid>
      <description>&lt;p&gt;If we want to share our website on social media such as Twitter, FB or LinkedIn, we may need to ensure our site is shareable and has a preview image, title and description. &lt;/p&gt;

&lt;p&gt;In order to do so, we need to include special metatags into our HTML head. Tags that have &lt;code&gt;twitter:&lt;/code&gt; keyword are required for Twitter cards, and tags with &lt;code&gt;og:&lt;/code&gt; keyword are for Facebook and LinkedIn cards. &lt;/p&gt;

&lt;p&gt;Here's an example of tags I added for a website I just finished and wanted to share on social.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    &amp;lt;meta name="twitter:card" content="summary" /&amp;gt;
    &amp;lt;meta name="twitter:site" content="@irinakramer" /&amp;gt;
    &amp;lt;meta name="twitter:title" content="Evaluate News with NLP" /&amp;gt;
    &amp;lt;meta name="twitter:description"
        content="Check an article for sentiment such as positivity, subjectivity and irony. Powered by MeaningCloud API." /&amp;gt;
    &amp;lt;meta name="twitter:image" content="https://evaluate-news-nlp-17.netlify.app/evaluate-news-screenshot.png" /&amp;gt;
    &amp;lt;meta property="og:title" content="Evaluate News with NLP" /&amp;gt;
    &amp;lt;meta property="og:description"
        content="Check an article for sentiment such as positivity, subjectivity and irony. Powered by MeaningCloud API." /&amp;gt;
    &amp;lt;meta property="og:type" content="website" /&amp;gt;
    &amp;lt;meta property="og:url" content="https://evaluate-news-nlp-17.netlify.app/" /&amp;gt;
    &amp;lt;meta property="og:image" content="https://evaluate-news-nlp-17.netlify.app/evaluate-news-screenshot.png" /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is how this tweet appears in my feed:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--B69Va3pE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/bqgaf6ryf1aw2o77ooub.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--B69Va3pE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/bqgaf6ryf1aw2o77ooub.png" alt="Alt Text" width="555" height="171"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Just to make sure our tags work correctly, we can validate them on Twitter and Facebook developer sites:&lt;br&gt;
&lt;a href="https://cards-dev.twitter.com/validator"&gt;https://cards-dev.twitter.com/validator&lt;/a&gt;&lt;br&gt;
&lt;a href="https://developers.facebook.com/tools/debug/"&gt;https://developers.facebook.com/tools/debug/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are more options for these tags and details can be found here:&lt;br&gt;
&lt;a href="https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/markup"&gt;https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/markup&lt;/a&gt;&lt;br&gt;
&lt;a href="https://ogp.me/"&gt;https://ogp.me/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;PS: This was my first ever blog post, so please forgive if something isn't perfect. Feedback is appreciated! &lt;/p&gt;

</description>
      <category>metatags</category>
      <category>twitter</category>
      <category>share</category>
      <category>social</category>
    </item>
  </channel>
</rss>
