<?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>Forem: Sana Khan</title>
    <description>The latest articles on Forem by Sana Khan (@sana_khan_c4716d273e04120).</description>
    <link>https://forem.com/sana_khan_c4716d273e04120</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%2F2396949%2F67648385-5ffd-4385-88ad-4e7b1d1b32e6.png</url>
      <title>Forem: Sana Khan</title>
      <link>https://forem.com/sana_khan_c4716d273e04120</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/sana_khan_c4716d273e04120"/>
    <language>en</language>
    <item>
      <title>Why Sorted Input Changes Everything in Array Intersection Problems</title>
      <dc:creator>Sana Khan</dc:creator>
      <pubDate>Mon, 23 Jun 2025 08:07:43 +0000</pubDate>
      <link>https://forem.com/sana_khan_c4716d273e04120/why-sorted-input-changes-everything-in-array-intersection-problems-4fja</link>
      <guid>https://forem.com/sana_khan_c4716d273e04120/why-sorted-input-changes-everything-in-array-intersection-problems-4fja</guid>
      <description>&lt;p&gt;Recently, I worked on two different coding problems — one from &lt;a href="https://leetcode.com/problems/intersection-of-two-arrays-ii/description/" rel="noopener noreferrer"&gt;LeetCode&lt;/a&gt; and another from &lt;a href="https://www.naukri.com/code360/problems/intersection-of-2-arrays_1082149?source=youtube&amp;amp;campaign=love_babbar_codestudio1&amp;amp;leftPanelTabValue=SUBMISSION" rel="noopener noreferrer"&gt;CodeStudio&lt;/a&gt; by Coding Ninjas — that both asked for the intersection of two arrays. At first glance, they looked quite similar, but I quickly learned that whether the input arrays are sorted or not changes everything.&lt;br&gt;
In this blog, I’ll walk through the two problems, my thought process, and the simple solutions I implemented without using any fancy data structures like hashmaps.&lt;/p&gt;
&lt;h2&gt;
  
  
  🧩 Problem 1: Intersection of Two Sorted Arrays (CodeStudio)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;🔹 Approach:&lt;/strong&gt;&lt;br&gt;
Since both arrays were already sorted, I decided to use the two-pointer technique to find common elements efficiently in linear time.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;bits/stdc++.h&amp;gt;
vector&amp;lt;int&amp;gt; findArrayIntersection(vector&amp;lt;int&amp;gt; &amp;amp;arr1, int n, vector&amp;lt;int&amp;gt; &amp;amp;arr2, int m)
{
    vector&amp;lt;int&amp;gt; res;
    int i = 0, j = 0;

    while (i &amp;lt; n &amp;amp;&amp;amp; j &amp;lt; m) {
        if (arr1[i] == arr2[j]) {
            res.push_back(arr1[i]);
            i++;
            j++;
        }
        else if (arr1[i] &amp;lt; arr2[j]) {
            i++;
        }
        else {
            j++;
        }
    }

    if (res.empty()) {
        res.push_back(-1);
    }

    return res;
}

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🧠 Key Insight:&lt;/strong&gt;&lt;br&gt;
Because the arrays are sorted, we can just walk through them simultaneously and compare elements directly — no need to sort or use extra space.&lt;/p&gt;
&lt;h2&gt;
  
  
  🧩 Problem 2: Intersection of Two Unsorted Arrays (LeetCode)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;🔹 Approach:&lt;/strong&gt;&lt;br&gt;
Here, the arrays weren’t sorted. So I used a brute-force approach with nested loops. For every element in the first array, I checked for its presence in the second array and added it to the result if found.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Solution {
public:
    vector&amp;lt;int&amp;gt; intersect(vector&amp;lt;int&amp;gt;&amp;amp; nums1, vector&amp;lt;int&amp;gt;&amp;amp; nums2) {
        vector&amp;lt;int&amp;gt; res;
        for(int i = 0; i &amp;lt; nums1.size(); i++){
            int element = nums1[i];
            for(int j = 0; j &amp;lt; nums2.size(); j++){
                if (element == nums2[j]){
                    res.push_back(element);
                    nums2[j] = -1; // mark as visited
                    break;
                }
            }
        }
        return res;
    }
};

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🧠 Key Insight:&lt;/strong&gt;&lt;br&gt;
Since the arrays weren’t sorted, we didn’t have the advantage of two-pointer traversal. Still, by marking visited elements in nums2, I was able to avoid duplicates without using extra space.&lt;/p&gt;

&lt;h2&gt;
  
  
  🎯 Final Thoughts:
&lt;/h2&gt;

&lt;p&gt;What surprised me most was how the sorted nature of the array entirely changed the optimal approach. Initially, I didn’t even realize one of the problems had sorted arrays — which led me to use a less efficient brute-force method at first.&lt;br&gt;
&lt;em&gt;Lesson learned: Always read the constraints carefully.&lt;/em&gt; Sometimes the presence (or absence) of something as simple as sorting can shift your entire approach — from nested loops to linear two-pointer techniques!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>✍️ First Attempt: Reversing Using a Temporary Array</title>
      <dc:creator>Sana Khan</dc:creator>
      <pubDate>Sun, 22 Jun 2025 13:03:35 +0000</pubDate>
      <link>https://forem.com/sana_khan_c4716d273e04120/first-attempt-reversing-using-a-temporary-array-1260</link>
      <guid>https://forem.com/sana_khan_c4716d273e04120/first-attempt-reversing-using-a-temporary-array-1260</guid>
      <description>&lt;p&gt;This is the approach many beginners (myself included) think of first:&lt;br&gt;
&lt;em&gt;“Why not create a new array and fill it in reverse order?”&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;iostream&amp;gt;
#include &amp;lt;vector&amp;gt;
using namespace std;

void reverseArray(vector&amp;lt;int&amp;gt; &amp;amp;arr) {
    int n = arr.size();
    vector&amp;lt;int&amp;gt; temp(n);

    for (int i = 0; i &amp;lt; n; i++)
        temp[i] = arr[n - i - 1];

    for (int i = 0; i &amp;lt; n; i++)
        arr[i] = temp[i];
}

int main() {
    vector&amp;lt;int&amp;gt; arr = {1, 4, 3, 2, 6, 5};
    reverseArray(arr);

    for (int val : arr)
        cout &amp;lt;&amp;lt; val &amp;lt;&amp;lt; " ";
}

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🔍 Analysis&lt;/strong&gt;&lt;br&gt;
✅ Simple and readable&lt;br&gt;
❌ Not memory-efficient – It uses an extra array of the same size (O(n) space)&lt;/p&gt;
&lt;h2&gt;
  
  
  ✅ Optimal Approach: In-Place Reversal Using Swapping
&lt;/h2&gt;

&lt;p&gt;Then I explored another way—swapping elements from both ends of the array until the middle is reached.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void reverseArray(vector&amp;lt;int&amp;gt;&amp;amp; arr) {
    int left = 0, right = arr.size() - 1;
    while (left &amp;lt; right) {
        swap(arr[left], arr[right]);
        left++;
        right--;
    }
}

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

&lt;/div&gt;



&lt;p&gt;Or Using a For Loop:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void reverseArray(vector&amp;lt;int&amp;gt;&amp;amp; arr) {
    for (int i = 0; i &amp;lt; arr.size() / 2; i++) {
        swap(arr[i], arr[arr.size() - 1 - i]);
    }
}

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🔍 Analysis&lt;/strong&gt;&lt;br&gt;
✅ Efficient – Reverses the array in O(n) time and O(1) space&lt;br&gt;
✅ Professional standard – Used in interviews and real-world problems&lt;br&gt;
✅ Doesn't require extra memory&lt;/p&gt;

</description>
    </item>
    <item>
      <title>LeetCode 231: Power of Two</title>
      <dc:creator>Sana Khan</dc:creator>
      <pubDate>Sat, 21 Jun 2025 05:14:05 +0000</pubDate>
      <link>https://forem.com/sana_khan_c4716d273e04120/leetcode-231-power-of-two-5eg1</link>
      <guid>https://forem.com/sana_khan_c4716d273e04120/leetcode-231-power-of-two-5eg1</guid>
      <description>&lt;h2&gt;
  
  
  🪜 Step 1: My Initial Solution – Converting to Binary
&lt;/h2&gt;

&lt;p&gt;My first thought was:&lt;br&gt;
&lt;em&gt;A number is a power of two only if its binary representation contains exactly one ‘1’.&lt;/em&gt;&lt;br&gt;
So I wrote a function to convert a number to its binary form and then counted how many 1s it had.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Solution {
public:
    string set_bit(int num){
        if (num == 0) return "0";
        string bin = "";
        while (num &amp;gt; 0){
            int rem = num % 2;
            bin += to_string(rem);
            num = num / 2;
        }
        return bin;  // binary in reverse order
    }

    bool isPowerOfTwo(int n) {
        string bits = set_bit(n);
        int count = 0;
        for (int i = 0; i &amp;lt; bits.length(); i++){
            if (bits[i] == '1') count++;
        }
        return count == 1;
    }
};

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

&lt;/div&gt;



&lt;p&gt;It worked! Even though the binary string is reversed, it didn’t matter since I only cared about the number of 1s.&lt;br&gt;
&lt;strong&gt;✅ What I Learned:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;How to convert a number to binary using % &lt;/li&gt;
&lt;li&gt;How to analyze the number of set bits (1s).&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  🧠 Step 2: A Cleaner Way – Count Set Bits Without Strings
&lt;/h2&gt;

&lt;p&gt;While reviewing other solutions, I realized I didn’t need to build a binary string at all. I could count the set bits directly while dividing the number.&lt;/p&gt;

&lt;p&gt;Here’s the improved solution:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Solution {
public:
    bool isPowerOfTwo(int n) {
        if (n &amp;lt;= 0) return false;
        int count = 0;

        while (n &amp;gt; 0) {
            if (n % 2 == 1) count++;  // count set bits
            n /= 2;
        }

        return count == 1;
    }
};

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

&lt;/div&gt;



&lt;p&gt;Much better! This avoids unnecessary string manipulation and directly counts the 1s.&lt;/p&gt;

&lt;h2&gt;
  
  
  💥 Step 3: The Most Efficient Way – Bit Manipulation Trick
&lt;/h2&gt;

&lt;p&gt;Finally, I stumbled upon this line of genius:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;return n &amp;gt; 0 &amp;amp;&amp;amp; (n &amp;amp; (n - 1)) == 0;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the most optimized and elegant solution to check if a number is a power of two. But… how does it work?&lt;br&gt;
&lt;strong&gt;🔍 How n &amp;amp; (n - 1) == 0 Works&lt;/strong&gt;&lt;br&gt;
Example 1:&lt;br&gt;
n = 8 → binary = 1000&lt;br&gt;
n - 1 = 7 → binary = 0111&lt;br&gt;
so (8&amp;amp;7)==0 is true,&lt;br&gt;
and 8&amp;gt;0 is also true ie n &amp;gt; 0 &amp;amp;&amp;amp; (n &amp;amp; (n - 1)) gives 1. ✅ result is 1 → so 8 is a power of 2 &lt;/p&gt;

&lt;p&gt;Example 2:&lt;br&gt;
n = 6 → binary = 1100&lt;br&gt;
n - 1 = 5 → binary = 1010&lt;br&gt;
so (6&amp;amp;5)==0 is false,&lt;br&gt;
and 6&amp;gt;0 is true ie n &amp;gt; 0 &amp;amp;&amp;amp; (n &amp;amp; (n - 1)) gives 0. ✅ result is 0 → so 6 is not a power of 2 &lt;br&gt;
&lt;strong&gt;🧠 Why This Works:&lt;/strong&gt;&lt;br&gt;
A power of two has exactly one set bit. Subtracting 1 from it flips that bit and all bits to the right of it.&lt;br&gt;
So n &amp;amp; (n - 1) results in 0 only if n had just one set bit.&lt;/p&gt;

&lt;p&gt;Here’s the final optimized version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Solution {
public:
    bool isPowerOfTwo(int n) {
        return n &amp;gt; 0 &amp;amp;&amp;amp; (n &amp;amp; (n - 1)) == 0;
    }
};

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

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>💻 Understanding Arrays in C++ Classes: A Student Score Program</title>
      <dc:creator>Sana Khan</dc:creator>
      <pubDate>Wed, 18 Jun 2025 06:52:14 +0000</pubDate>
      <link>https://forem.com/sana_khan_c4716d273e04120/understanding-arrays-in-c-classes-a-student-score-program-4jeo</link>
      <guid>https://forem.com/sana_khan_c4716d273e04120/understanding-arrays-in-c-classes-a-student-score-program-4jeo</guid>
      <description>&lt;p&gt;In this blog, I’ll walk you through a simple yet effective C++ program that uses classes and objects to manage student scores and determine how many students scored more than the first student.&lt;/p&gt;

&lt;p&gt;Let’s break it down together! 🧩&lt;/p&gt;

&lt;h2&gt;
  
  
  🧠 Problem Statement
&lt;/h2&gt;

&lt;p&gt;We have a group of students. Each student gives five test scores. We want to calculate how many students scored more than the first student.&lt;/p&gt;

&lt;p&gt;Simple, right? Now let's dive into how this is achieved using classes in C++.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧑‍🎓 Creating the Student Class
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Student {
private:
    int scores[5]; // Each student has 5 scores
public:
    void input();
    int calculateTotalScore();
};

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

&lt;/div&gt;



&lt;p&gt;We define a class Student to encapsulate the scores and operations.&lt;/p&gt;

&lt;p&gt;scores[5] is a fixed-size array holding 5 test scores.&lt;/p&gt;

&lt;p&gt;input() allows entering the scores.&lt;/p&gt;

&lt;p&gt;calculateTotalScore() adds up the scores.&lt;/p&gt;

&lt;h2&gt;
  
  
  🖊️ Input Function
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void Student::input() {
    for (int i = 0; i &amp;lt; 5; i++) {
        cin &amp;gt;&amp;gt; scores[i];
    }
}

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

&lt;/div&gt;



&lt;p&gt;This method allows each student object to take 5 scores as input from the user.&lt;/p&gt;

&lt;h2&gt;
  
  
  ➕ Score Calculation
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int Student::calculateTotalScore() {
    int sum = 0;
    for (int i = 0; i &amp;lt; 5; i++) {
        sum += scores[i];
    }
    return sum;
}

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

&lt;/div&gt;



&lt;p&gt;This method calculates the total score for each student by summing up their individual scores.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧮 Main Function Logic
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int main() {
    int n;
    cin &amp;gt;&amp;gt; n;
    vector&amp;lt;Student&amp;gt; Students(n);
    int num = 0;

    for (int i = 0; i &amp;lt; n; i++) {
        Students[i].input();
        if (Students[0].calculateTotalScore() &amp;lt; Students[i].calculateTotalScore()) {
            num++;
        }
    }

    cout &amp;lt;&amp;lt; num;
}

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;First, we take the number of students n.&lt;/li&gt;
&lt;li&gt;We create a vector of Student objects.&lt;/li&gt;
&lt;li&gt;For each student:&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;We take input for their scores.&lt;/li&gt;
&lt;li&gt;We compare their total score with that of the first student.&lt;/li&gt;
&lt;li&gt;if it’s greater, we increment num.&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Finally, we print how many students scored more than the first student.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Sample Input/ output
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Input:

4
100 50 40 80 70
30 40 100 90 80
60 60 60 60 60
70 70 70 70 70

Output:
2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Explanation: First student’s total score = 340.&lt;br&gt;
Student 2 = 340 → not greater.&lt;br&gt;
Student 3 = 300 → less.&lt;br&gt;
Student 4 = 350 → greater.&lt;/p&gt;

&lt;p&gt;Only Student 4 scored more → output is 1.&lt;/p&gt;

&lt;h2&gt;
  
  
  🎯 Learning Outcomes
&lt;/h2&gt;

&lt;p&gt;Writing this program helped me understand some key concepts in C++ that were initially confusing but became clearer as I practiced more. Here’s what I learned:&lt;/p&gt;

&lt;p&gt;✅ How to use arrays inside a class: Initially, I wasn’t sure how to declare and access an array as a class member, but implementing scores[5] inside the Student class made it clear.&lt;/p&gt;

&lt;p&gt;✅ Objects can be stored in arrays or vectors: I learned that we can create an array or vector of objects like vector Students(n);. This was new and slightly confusing at first because we often only work with single objects, not collections of them.&lt;/p&gt;

&lt;p&gt;✅ How vectors work with classes: Using a vector to manage multiple objects made the program more flexible and dynamic. It felt tricky at first, but I now understand how powerful it is when dealing with multiple instances of a class.&lt;/p&gt;

&lt;p&gt;✅ Logical comparisons become easier with OOP: Initially, I thought I’d have to compare every student with every other student. But thankfully, the problem only asked me to compare each one with the first student — which simplified the logic a lot and helped me focus more on the object-oriented part.&lt;/p&gt;

&lt;p&gt;This task gave me a real confidence boost in using OOP with arrays and vectors, and it made me realize how clean and manageable code becomes once you start thinking in terms of objects rather than just variables.&lt;/p&gt;

</description>
      <category>cpp</category>
      <category>programming</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>✨Fixing Integer Overflow in C++ with Circular Indexing</title>
      <dc:creator>Sana Khan</dc:creator>
      <pubDate>Fri, 13 Jun 2025 11:06:46 +0000</pubDate>
      <link>https://forem.com/sana_khan_c4716d273e04120/fixing-integer-overflow-in-c-with-circular-indexing-3j36</link>
      <guid>https://forem.com/sana_khan_c4716d273e04120/fixing-integer-overflow-in-c-with-circular-indexing-3j36</guid>
      <description>&lt;h1&gt;
  
  
  🌀 I Didn't Know Circular Indexing — Here's What Went Wrong (and How I Fixed It)
&lt;/h1&gt;

&lt;p&gt;When I first saw a simple problem — &lt;strong&gt;“Find the sum of every 4 consecutive elements in an array of 5 elements, wrapping around circularly”&lt;/strong&gt; — I thought, &lt;em&gt;"Easy!"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;So I wrote my usual loops, added the elements, and printed the results.&lt;/p&gt;

&lt;p&gt;It worked… until it didn’t.&lt;/p&gt;

&lt;p&gt;That’s when I learned about &lt;strong&gt;circular indexing&lt;/strong&gt;, and even more importantly, &lt;strong&gt;integer overflow&lt;/strong&gt;. Here's how it all unfolded.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧪 The Problem
&lt;/h2&gt;

&lt;p&gt;Given 5 integers, I needed to calculate 5 sums. Each sum should include 4 consecutive elements from the array, but with wrapping.&lt;/p&gt;

&lt;p&gt;For example, given:&lt;/p&gt;

&lt;p&gt;The sums should be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;1+2+3+4 = 10&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;2+3+4+5 = 14&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;3+4+5+1 = 13&lt;/code&gt;  ← wrapped&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;4+5+1+2 = 12&lt;/code&gt;  ← wrapped&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;5+1+2+3 = 11&lt;/code&gt;  ← wrapped&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🔨 My First (Flawed) Approach
&lt;/h2&gt;

&lt;p&gt;I began writing the logic like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;sum1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;a&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="n"&gt;a&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="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;a&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="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;sum2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;a&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="n"&gt;a&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="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;a&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="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;a&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="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;sum3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;a&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="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;a&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="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;a&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="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;a&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="c1"&gt;// 🚨 Oops!&lt;/span&gt;

&lt;span class="n"&gt;That&lt;/span&gt; &lt;span class="n"&gt;last&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;Totally&lt;/span&gt; &lt;span class="n"&gt;wrong&lt;/span&gt; &lt;span class="err"&gt;—&lt;/span&gt; &lt;span class="n"&gt;a&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="n"&gt;doesn&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="n"&gt;even&lt;/span&gt; &lt;span class="n"&gt;exist&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
&lt;span class="n"&gt;I&lt;/span&gt; &lt;span class="n"&gt;was&lt;/span&gt; &lt;span class="n"&gt;trying&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;access&lt;/span&gt; &lt;span class="n"&gt;indices&lt;/span&gt; &lt;span class="n"&gt;beyond&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;


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

&lt;/div&gt;



&lt;h2&gt;
  
  
  🧭 Discovery: Circular Indexing
&lt;/h2&gt;

&lt;p&gt;After some searching and trial &amp;amp; error, I discovered modulo indexing.&lt;br&gt;
Using % (modulo operator), I could wrap around to index 0 when I go beyond 4.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for (int i = 0; i &amp;lt; 5; i++) {
    for (int j = i; j &amp;lt; i + 4; j++) {
        sum[i] += a[j % 5];  // this wraps around the array
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🚧 The Next Bug: It Still Broke for Big Inputs
&lt;/h2&gt;

&lt;p&gt;📛 Integer Overflow — I was using int, which can only store up to ~2.1 billion.&lt;br&gt;
So I changed everything to long long.&lt;/p&gt;

&lt;h2&gt;
  
  
  ✅ The Final Code (Bug-Free and Clean)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;iostream&amp;gt;
using namespace std;

int main() {
    long long a[5];
    for (int i = 0; i &amp;lt; 5; i++) cin &amp;gt;&amp;gt; a[i];

    long long sum[5] = {0};

    for (int i = 0; i &amp;lt; 5; i++) {
        for (int j = i; j &amp;lt; i + 4; j++) {
            sum[i] += a[j % 5];  // circular indexing
        }
    }

    for (int i = 0; i &amp;lt; 5; i++) {
        cout &amp;lt;&amp;lt; sum[i] &amp;lt;&amp;lt; endl;
    }

    long long max = sum[0], min = sum[0];
    for (int i = 0; i &amp;lt; 5; i++) {
        if (sum[i] &amp;gt; max) max = sum[i];
        if (sum[i] &amp;lt; min) min = sum[i];
    }

    cout &amp;lt;&amp;lt; min &amp;lt;&amp;lt; " " &amp;lt;&amp;lt; max;
    return 0;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>programming</category>
      <category>beginners</category>
      <category>productivity</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Mastering Layered Patterns: A Step-by-Step Guide to Solving Grid and Matrix Challenges with Position-Based Logic</title>
      <dc:creator>Sana Khan</dc:creator>
      <pubDate>Sat, 12 Apr 2025 11:30:41 +0000</pubDate>
      <link>https://forem.com/sana_khan_c4716d273e04120/mastering-layered-patterns-a-step-by-step-guide-to-solving-grid-and-matrix-challenges-with-baj</link>
      <guid>https://forem.com/sana_khan_c4716d273e04120/mastering-layered-patterns-a-step-by-step-guide-to-solving-grid-and-matrix-challenges-with-baj</guid>
      <description>&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/sana_khan_c4716d273e04120/the-spiral-struggle-how-i-cracked-the-concentric-number-pattern-in-c-5hli" class="crayons-story__hidden-navigation-link"&gt;🌀 The Spiral Struggle: How I Cracked the Concentric Number Pattern in C&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;

          &lt;a href="/sana_khan_c4716d273e04120" class="crayons-avatar  crayons-avatar--l  "&gt;
            &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2396949%2F67648385-5ffd-4385-88ad-4e7b1d1b32e6.png" alt="sana_khan_c4716d273e04120 profile" class="crayons-avatar__image"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/sana_khan_c4716d273e04120" class="crayons-story__secondary fw-medium m:hidden"&gt;
              Sana Khan
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                Sana Khan
                
              
              &lt;div id="story-author-preview-content-2402009" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/sana_khan_c4716d273e04120" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&gt;
                        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2396949%2F67648385-5ffd-4385-88ad-4e7b1d1b32e6.png" class="crayons-avatar__image" alt=""&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;Sana Khan&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

          &lt;/div&gt;
          &lt;a href="https://dev.to/sana_khan_c4716d273e04120/the-spiral-struggle-how-i-cracked-the-concentric-number-pattern-in-c-5hli" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;Apr 12 '25&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/sana_khan_c4716d273e04120/the-spiral-struggle-how-i-cracked-the-concentric-number-pattern-in-c-5hli" id="article-link-2402009"&gt;
          🌀 The Spiral Struggle: How I Cracked the Concentric Number Pattern in C
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/programming"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;programming&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/beginners"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;beginners&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/tutorial"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;tutorial&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/productivity"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;productivity&lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
          &lt;a href="https://dev.to/sana_khan_c4716d273e04120/the-spiral-struggle-how-i-cracked-the-concentric-number-pattern-in-c-5hli" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left"&gt;
            &lt;div class="multiple_reactions_aggregate"&gt;
              &lt;span class="multiple_reactions_icons_container"&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/sparkle-heart-5f9bee3767e18deb1bb725290cb151c25234768a0e9a2bd39370c382d02920cf.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
              &lt;/span&gt;
              &lt;span class="aggregate_reactions_counter"&gt;1&lt;span class="hidden s:inline"&gt; reaction&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/a&gt;
            &lt;a href="https://dev.to/sana_khan_c4716d273e04120/the-spiral-struggle-how-i-cracked-the-concentric-number-pattern-in-c-5hli#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              Comments


              &lt;span class="hidden s:inline"&gt;Add Comment&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            4 min read
          &lt;/small&gt;
            
              &lt;span class="bm-initial"&gt;
                

              &lt;/span&gt;
              &lt;span class="bm-success"&gt;
                

              &lt;/span&gt;
            
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;


</description>
      <category>programming</category>
      <category>algorithms</category>
      <category>c</category>
      <category>discuss</category>
    </item>
    <item>
      <title>🌀 The Spiral Struggle: How I Cracked the Concentric Number Pattern in C</title>
      <dc:creator>Sana Khan</dc:creator>
      <pubDate>Sat, 12 Apr 2025 11:30:01 +0000</pubDate>
      <link>https://forem.com/sana_khan_c4716d273e04120/the-spiral-struggle-how-i-cracked-the-concentric-number-pattern-in-c-5hli</link>
      <guid>https://forem.com/sana_khan_c4716d273e04120/the-spiral-struggle-how-i-cracked-the-concentric-number-pattern-in-c-5hli</guid>
      <description>&lt;p&gt;You know that rush when you finally figure something out after banging your head against a wall for hours? That was me trying to solve a deceptively simple-looking pattern problem in C.&lt;/p&gt;

&lt;p&gt;Here’s the challenge:&lt;br&gt;
Problem:&lt;br&gt;
Given a number n, print a (2n-1) x (2n-1) square pattern where the numbers decrease in layers towards the center.&lt;/p&gt;

&lt;p&gt;For example, if n = 4, the output should look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;4 4 4 4 4 4 4
4 3 3 3 3 3 4
4 3 2 2 2 3 4
4 3 2 1 2 3 4
4 3 2 2 2 3 4
4 3 3 3 3 3 4
4 4 4 4 4 4 4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🧠 Step 1: Overthinking the Basics
&lt;/h2&gt;

&lt;p&gt;First, I tried to figure out the number of rows and columns. You’d think that’s obvious—it’s just 2*n - 1—but I spent way longer than I should have on that. (We all have our moments.)&lt;/p&gt;

&lt;p&gt;Once I had that, I did the obvious thing: print a square of that size filled with n.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
int main(){
    int n;
    scanf("%d", &amp;amp;n);
    for(int i = 1; i &amp;lt;= (2*n) - 1; i++){
        for(int j = 1; j &amp;lt;= (2*n) - 1; j++){
            printf("%d ", n);
        }
        printf("\n");
    }
    return 0;
}

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

&lt;/div&gt;



&lt;p&gt;Output? A big block of the number n. Cool... but very wrong.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧱 Step 2: Brute Force Attempts
&lt;/h2&gt;

&lt;p&gt;Then came a new idea: check manually which layer a position falls into and print accordingly. For n = 2, I hardcoded the edges:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int n;
scanf("%d", &amp;amp;n);
for(int i=1; i &amp;lt;= (2*n) - 1; i++){
    for(int j=1; j &amp;lt;= (2*n) - 1; j++){
        if((i==1 || i==(2*n)-1) || (j==1 || j==(2*n)-1)){
            printf("%d ", n);  
        } else {
            printf("%d ", n-1);
        }
    }
    printf("\n");
}

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

&lt;/div&gt;



&lt;p&gt;It worked... but only for n=2.&lt;/p&gt;

&lt;p&gt;So I extended it manually:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;else if((i==2 || i==(2*n)-2) || (j==2 || j==(2*n)-2)) { printf("%d ", n-1); }
else if((i==3 || i==(2*n)-3) || (j==3 || j==(2*n)-3)) { printf("%d ", n-2); }
// and so on...

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

&lt;/div&gt;



&lt;p&gt;It started getting messy—really messy. It wasn’t scalable, elegant, or fun anymore.&lt;/p&gt;

&lt;h2&gt;
  
  
  ✨ Step 3: The Breakthrough — It’s Just the Distance from the Edge!
&lt;/h2&gt;

&lt;p&gt;After a ton of brainstorming and frustration, I had a click moment — and it wasn’t from any tutorial or AI assistant. Nobody spelled it out clearly.&lt;/p&gt;

&lt;p&gt;I realized: The number we print is just the distance from the nearest edge, subtracted from n.&lt;br&gt;
Not “layers,” not “boundaries,” not “top-left-bottom-right calculations” — just pure distance from the nearest edge.&lt;/p&gt;

&lt;p&gt;That’s it.&lt;/p&gt;

&lt;p&gt;Let me break it down.&lt;/p&gt;

&lt;p&gt;Imagine standing at any position in the square. Ask yourself:&lt;br&gt;
“How close am I to any edge?”&lt;/p&gt;

&lt;p&gt;Take the minimum of these:&lt;/p&gt;

&lt;p&gt;Distance from the top → i&lt;/p&gt;

&lt;p&gt;Distance from the left → j&lt;/p&gt;

&lt;p&gt;Distance from the bottom → size - 1 - i&lt;/p&gt;

&lt;p&gt;Distance from the right → size - 1 - j&lt;/p&gt;

&lt;p&gt;That minimum value is your depth into the square.&lt;br&gt;
And then the number to print is just:&lt;br&gt;
&lt;code&gt;n - depth&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
Here’s the full code again with this mindset:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
int main(){
    int n;
    scanf("%d", &amp;amp;n);
    int size = (2 * n) - 1;

    for(int i = 0; i &amp;lt; size; i++){
        for(int j = 0; j &amp;lt; size; j++){
            // calculate distance from all four edges
            int top = i;
            int left = j;
            int bottom = size - i - 1;
            int right = size - j - 1;

            // get the minimum distance = depth into the square
            int distance = top;
            if (left &amp;lt; distance) distance = left;
            if (bottom &amp;lt; distance) distance = bottom;
            if (right &amp;lt; distance) distance = right;

            // now subtract from n to get the number to print
            printf("%d ", n - distance);
        }
        printf("\n");
    }
    return 0;
}

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  💡 Why This Realization Mattered
&lt;/h2&gt;

&lt;p&gt;All the online explanations talked in abstract terms: “layers,” “rings,” “boundaries,” etc.&lt;br&gt;
But none said the simplest, clearest truth:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You're just printing numbers based on how close you are to the nearest edge.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Once I saw it that way, the logic felt natural — like peeling an onion, one layer at a time.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧠 A Few Little Things I Learned Along the Way
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Why bottom = size - i - 1 instead of size - i.&lt;br&gt;
This tripped me up at first — but it’s because array (or loop) indexing starts at 0. So the last row isn’t at index size, it’s at index size - 1. That -1 matters more than you'd think!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Why I used multiple if conditions instead of else if&lt;br&gt;
When calculating layer, we need to find the minimum distance to any edge — top, left, bottom, or right. That means we have to compare all four and keep the smallest one. If I had used else if, it would've skipped checking some of them. Using plain if ensures each comparison is made.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the pattern was based on a fixed n (already given) rather than dynamic positioning, it would’ve been easier to brute-force with an if-else block like I did earlier. That approach just doesn't scale well or adapt cleanly to any n, which is why understanding the "distance from the edge" concept changed everything.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  🧠 More Questions That Use This Approach
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Distance from Center Grid Pattern&lt;/li&gt;
&lt;li&gt;Square Frame Numbers Pattern&lt;/li&gt;
&lt;li&gt;Spiral Matrix Generation&lt;/li&gt;
&lt;li&gt;Pattern with Border and Diagonals&lt;/li&gt;
&lt;li&gt;Diamond Number Pattern&lt;/li&gt;
&lt;li&gt;Layered Star Pattern&lt;/li&gt;
&lt;li&gt;Grid with Center Highlighted&lt;/li&gt;
&lt;li&gt;Hollow Square with Layers&lt;/li&gt;
&lt;li&gt;Symmetric Number Pyramid in a Square Grid&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>programming</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
