<?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: Oluwanifemi Latunde</title>
    <description>The latest articles on DEV Community by Oluwanifemi Latunde (@nifilat).</description>
    <link>https://dev.to/nifilat</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%2F877577%2F5e945d8c-29bf-4e43-ba3f-4de5cfe9a5fa.png</url>
      <title>DEV Community: Oluwanifemi Latunde</title>
      <link>https://dev.to/nifilat</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nifilat"/>
    <language>en</language>
    <item>
      <title>Journey to Backend Development</title>
      <dc:creator>Oluwanifemi Latunde</dc:creator>
      <pubDate>Tue, 02 Jul 2024 13:35:03 +0000</pubDate>
      <link>https://dev.to/nifilat/journey-to-backend-development-4pla</link>
      <guid>https://dev.to/nifilat/journey-to-backend-development-4pla</guid>
      <description>&lt;p&gt;Having been a frontend developer for years, transitioning to backend development was a bit of a struggle, but a fun one.&lt;/p&gt;

&lt;p&gt;I started my journey in tech by learning Python, and it always stuck with me. That's why there was no surprise when I decided to choose Django as the backend framework I wanted to learn.&lt;/p&gt;

&lt;p&gt;Starting off, connecting to a database was a challenge for me. It was not easy to make a connection between my Django application and a database during a project I recently worked on. This problem hindered the development process and put the whole application in danger. In this task, I had to create a link connecting Django and PostgreSQL (it had to be done so that data could be fetched out of the storage as well as written in it).&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Step-by-Step Solution&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Identifying the Problem&lt;/strong&gt;&lt;br&gt;
I examined the error logs and found that connection timeouts were frequent when the application attempted to connect to the database. It meant there was a potential problem with either the database server or the connection string.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Setting Up PostgreSQL&lt;/strong&gt;&lt;br&gt;
I made sure that PostgreSQL was installed and running properly. I used the commands below on my local machine to verify the status and start PostgreSQL service:&lt;br&gt;
&lt;code&gt;sudo service postgresql status&lt;br&gt;
sudo service postgresql start&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Configuring Django Settings&lt;/strong&gt;&lt;br&gt;
I then made changes to settings.py in my Django project to set up the correct configuration of the database. This is in the folder named after your project under the main directory of the project. There was also some settings in the form of the database name along with the user, the address of the database server (host) as well as the port number if any. &lt;/p&gt;

&lt;p&gt;The following is part of the amended settings.py file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'mydatabase',
        'USER': 'oluwanifemi',
        'PASSWORD': 'password',
        'HOST': 'localhost',
        'PORT': '5432',
    }
}

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4: Installing psycopg2&lt;/strong&gt;&lt;br&gt;
To enable Django to communicate with PostgreSQL, I needed to install the psycopg2 library, which is the PostgreSQL adapter for Python and it was done using pip.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5: Applying Migrations&lt;/strong&gt;&lt;br&gt;
With the database configuration set up, I applied the migrations to create the necessary database tables.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 6: Testing the Connection&lt;/strong&gt;&lt;br&gt;
To verify that the connection was successful, I created a simple view in Django to interact with the database. I added a new entry to one of the models and retrieved it to ensure data was being stored and fetched correctly.&lt;/p&gt;

&lt;p&gt;I enjoyed solving the back-end challenge because it helped me understand that being persistent in my learning process is paramount. That's why I believe that I should move forward with learning through the HNG internship. As such, I feel excited to solve harder puzzles as well as work with experienced developers and those who resemble me in their reasoning practices for lifelong learning. Through the HNG Internship program, my growth potential is limitless due to the opportunity it provides in terms of access to various mentors, enabling me to sharpen these skills in backend development. &lt;/p&gt;

&lt;p&gt;I encourage anyone interested in enhancing their technical skills to explore the HNG internship program. You can learn more about the program &lt;a href="https://hng.tech/internship"&gt;here&lt;/a&gt; and you can also apply for the premium feature &lt;a href="https://hng.tech/premium"&gt;here&lt;/a&gt;.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Valid Number</title>
      <dc:creator>Oluwanifemi Latunde</dc:creator>
      <pubDate>Fri, 30 Sep 2022 22:41:43 +0000</pubDate>
      <link>https://dev.to/nifilat/valid-number-2aia</link>
      <guid>https://dev.to/nifilat/valid-number-2aia</guid>
      <description>&lt;p&gt;Today marks the last day of the #I4G10DaysOfCodeChallenge. Today's challenge featured validating an array of numbers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt;&lt;br&gt;
A valid number can be split up into these components (in order):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A decimal number or an integer.&lt;/li&gt;
&lt;li&gt;(Optional) An 'e' or 'E', followed by an integer.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A decimal number can be split up into these components (in order):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;(Optional) A sign character (either '+' or '-').&lt;/li&gt;
&lt;li&gt;One of the following formats:

&lt;ol&gt;
&lt;li&gt;One or more digits, followed by a dot '.'.&lt;/li&gt;
&lt;li&gt;One or more digits, followed by a dot '.', followed by one or more digits.&lt;/li&gt;
&lt;li&gt;A dot '.', followed by one or more digits.&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;An integer can be split up into these components (in order):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;(Optional) A sign character (either '+' or '-').&lt;/li&gt;
&lt;li&gt;One or more digits.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;For example, all the following are valid numbers: ["2", "0089", "-0.1", "+3.14", "4.", "-.9", "2e10", "-90E3", "3e+7", "+6e-1", "53.5e93", "-123.456e789"], while the following are not valid numbers: ["abc", "1a", "1e", "e3", "99e2.5", "--6", "-+3", "95a54e53"].
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;Basic Checks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We know that a valid number cannot have more than 1 decimal point, so we declare a variable to store if the decimal has been used or not. The initial value is False.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Also, we need to have at least one integer for the number to be valid. We can have alphabet 'e' or 'E', but a number needs to be after it. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next we have a while loop, and iterate each character as we go along and if we get anything that is invalid, we return False.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Otherwise we keep going till the end of the string and if we have seen at least one number then it means our number is valid.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Merge k Sorted Lists</title>
      <dc:creator>Oluwanifemi Latunde</dc:creator>
      <pubDate>Thu, 29 Sep 2022 21:13:23 +0000</pubDate>
      <link>https://dev.to/nifilat/merge-k-sorted-lists-3288</link>
      <guid>https://dev.to/nifilat/merge-k-sorted-lists-3288</guid>
      <description>&lt;p&gt;Day 9 of the #I4G10DaysOfCodeChallenge was to merge k sorted lists.&lt;/p&gt;

&lt;p&gt;You are given an array of k linked-lists lists, each linked-list is sorted in ascending order.&lt;/p&gt;

&lt;p&gt;Merge all the linked-lists into one sorted linked-list and return it.&lt;br&gt;
&lt;/p&gt;

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

Input: lists = [[1,4,5],[1,3,4],[2,6]]
Output: [1,1,2,3,4,4,5,6]
Explanation: The linked-lists are:
[
  1-&amp;gt;4-&amp;gt;5,
  1-&amp;gt;3-&amp;gt;4,
  2-&amp;gt;6
]
merging them into one sorted list:
1-&amp;gt;1-&amp;gt;2-&amp;gt;3-&amp;gt;4-&amp;gt;4-&amp;gt;5-&amp;gt;6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Approach:&lt;/strong&gt;&lt;br&gt;
The Divide and Conquer strategy is covered in this challenge. This method operates in O and doesn't require additional heap space (nk Log k)&lt;br&gt;
The merging of two linked lists can be accomplished in O(n) time and O(n) space, as is well known.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The plan is to merge each pair in linear time utilising O(n) space after pairing up K lists.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;K/2 lists, each of size 2*N, are left after the initial cycle. K/4 lists, each of size 4*N, are left after the second cycle.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Continue the process until there is just one list left.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Thank You❤️&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Combine Two Tables</title>
      <dc:creator>Oluwanifemi Latunde</dc:creator>
      <pubDate>Wed, 28 Sep 2022 18:44:05 +0000</pubDate>
      <link>https://dev.to/nifilat/combine-two-tables-2m0o</link>
      <guid>https://dev.to/nifilat/combine-two-tables-2m0o</guid>
      <description>&lt;p&gt;Day 8 of the #I4G10DaysOfCodeChallenge featured combining two tables in SQL. You can read more about the problem &lt;a href="https://leetcode.com/problems/combine-two-tables/description/"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Table: Person&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;+-------------+---------+
| Column Name | Type    |
+-------------+---------+
| personId    | int     |
| lastName    | varchar |
| firstName   | varchar |
+-------------+---------+
personId is the primary key column for this table.
This table contains information about the ID of some persons and their first and last names.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Table: Address&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;+-------------+---------+
| Column Name | Type    |
+-------------+---------+
| addressId   | int     |
| personId    | int     |
| city        | varchar |
| state       | varchar |
+-------------+---------+
addressId is the primary key column for this table.
Each row of this table contains information about the city and state of one person with ID = PersonId.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt;&lt;br&gt;
Write an SQL query to report the first name, last name, city, and state of each person in the Person table. If the address of a personId is not present in the Address table, report null instead.&lt;/p&gt;

&lt;p&gt;Return the result table in any order.&lt;/p&gt;

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

&lt;p&gt;When combining rows from two or more tables based on a shared column, a JOIN clause is utilised.&lt;br&gt;
There are different kind of JOINS in SQL and you can read more about it in the &lt;a href="https://www.w3schools.com/sql/sql_join.asp"&gt;w3schools Tutorial on SQL&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Because we are not exactly fixated on finding matching values in the table we can use either a LEFT or RIGHT JOIN depending on the sequence in which you write your SQL query.&lt;/p&gt;

&lt;p&gt;The LEFT JOIN keyword returns all records from the left table (Person) , and the matching records from the right table (Address) . The result is 0 records from the right side, if there is no match.&lt;/p&gt;

&lt;p&gt;The RIGHT JOIN keyword returns all records from the right table (Person), and the matching records from the left table (Address). The result is 0 records from the left side, if there is no match.&lt;/p&gt;

&lt;p&gt;Thank You🫶🏼&lt;/p&gt;

</description>
    </item>
    <item>
      <title>UTF-8 Validation</title>
      <dc:creator>Oluwanifemi Latunde</dc:creator>
      <pubDate>Tue, 27 Sep 2022 21:05:33 +0000</pubDate>
      <link>https://dev.to/nifilat/utf-8-validation-55ll</link>
      <guid>https://dev.to/nifilat/utf-8-validation-55ll</guid>
      <description>&lt;p&gt;It's day 7 of the #I4G10DaysOfCodeChallenge. The objective of today's task was to determine whether the set of integers constitutes a valid UTF8 string or not.&lt;/p&gt;

&lt;p&gt;You can find more details about the challenge &lt;a href="https://leetcode.com/problems/utf-8-validation/"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A character in UTF-8 can be from 1 to 4 bytes long, subjected to the following rules:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;For a 1-byte character, the first bit is a 0, followed by its Unicode code.&lt;/li&gt;
&lt;li&gt;For n-bytes character, the first n-bits are all ones, the n+1 bit is 0, followed by n-1 bytes with the most significant 2 bits being 10.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     Number of Bytes   |        UTF-8 Octet Sequence
                       |              (binary)
   --------------------+-----------------------------------------
            1          |   0xxxxxxx
            2          |   110xxxxx 10xxxxxx
            3          |   1110xxxx 10xxxxxx 10xxxxxx
            4          |   11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;ol&gt;
&lt;li&gt;Start with count = 0.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;for “c” ranging from 0 to the size of the data array.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the count is 0, then:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If x/32 = 110, then set count as 1. (x/32 is same as doing x &amp;gt;&amp;gt; 5 )&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Else if x/16 = 1110, then count = 2 (x/16 is same as doing x &amp;gt;&amp;gt; 4 )&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Else If x/8 = 11110, then count = 3. (x/8 is same as doing x &amp;gt;&amp;gt; 3 )&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Else if x/128 is 0, then return false. (x/128 is same as doing x &amp;gt;&amp;gt; 7 )&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Else If x/64 is not 10, then return false and decrease the count by 1. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When the count is 0, return true.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Result&lt;/strong&gt;:&lt;br&gt;
Runtime: 234 ms, faster than 56.39% of Python3 online submissions for UTF-8 Validation.&lt;/p&gt;

&lt;p&gt;Memory Usage: 14.1 MB, less than 97.22% of Python3 online submissions for UTF-8 Validation.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Fizz Buzz Multithreaded</title>
      <dc:creator>Oluwanifemi Latunde</dc:creator>
      <pubDate>Mon, 26 Sep 2022 21:30:00 +0000</pubDate>
      <link>https://dev.to/nifilat/fizz-buzz-multithreaded-4k5p</link>
      <guid>https://dev.to/nifilat/fizz-buzz-multithreaded-4k5p</guid>
      <description>&lt;p&gt;Day 6 of the #I4G10DaysOfCodeChallenge, and it is the multi-threaded variant of the well-known fizz buzz problem on Leetcode. &lt;/p&gt;

&lt;p&gt;We want the four different threads—fizz, buzz, fizzbuzz, and number—to create the output in the proper order. Each thread will call one of the four functions—fizz, buzz, fizzbuzz, and number—exactly once.&lt;/p&gt;

&lt;p&gt;I used the locking method to solve this problem.&lt;/p&gt;

&lt;p&gt;Despite the fact that there are four separate loops, only one will ever increase the shared counter variable because of the mutually exclusive if conditions. They never stop spinning until it's "their turn" to print an output and increase the value of the counter.&lt;/p&gt;

</description>
      <category>python</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>Sort Characters By Frequency</title>
      <dc:creator>Oluwanifemi Latunde</dc:creator>
      <pubDate>Sun, 25 Sep 2022 21:02:26 +0000</pubDate>
      <link>https://dev.to/nifilat/sort-characters-by-frequency-1db3</link>
      <guid>https://dev.to/nifilat/sort-characters-by-frequency-1db3</guid>
      <description>&lt;p&gt;Day 5 of the #I4G10DaysOfCodeChallenge featured sorting a given string in decreasing order based on frequency of the characters. The frequency of a character is the number of times it appears in the string.&lt;/p&gt;

&lt;p&gt;The idea was to sort the vector pairs in accordance with the frequency that was stored after storing each letter together with its frequency in a vector of pairs. The vector should then be printed in order.&lt;/p&gt;

&lt;p&gt;The steps I took were as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Return count of character in the string by declaring a count variable, assigning it to an empty dictionary and updating it as you loop through all the characters in the string.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next was to sort the vector, according to the number of characters.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;And finally, to print the sorted vector content.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thank You.&lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>python</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Print in Order</title>
      <dc:creator>Oluwanifemi Latunde</dc:creator>
      <pubDate>Sat, 24 Sep 2022 22:01:14 +0000</pubDate>
      <link>https://dev.to/nifilat/print-in-order-1428</link>
      <guid>https://dev.to/nifilat/print-in-order-1428</guid>
      <description>&lt;p&gt;It's day four already💃🏽. Today's challenge was on printing in order. Basically, the challenge was about synchronisation. It involved designing a mechanism and modifying the program to ensure that second() is executed after first(), and third() is executed after second().&lt;/p&gt;

&lt;p&gt;I used the locking tool of the threading module in python which was a new concept I just learnt.&lt;/p&gt;

&lt;p&gt;Locks are a synchronisation tool included in the Python threading module. Locks exist in two states:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Locked&lt;/li&gt;
&lt;li&gt;Unlocked&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With the use of the acquire() method, a lock can be locked. All additional attempts to acquire the lock are prohibited once a thread has already gained it until it is released. The release() method can be used to release the lock.&lt;/p&gt;

&lt;p&gt;The syntax was to release the first thread and lock the other two. Once the first thread has been executed it is locked and the sequence repeats till all the threads have been executed.&lt;/p&gt;

&lt;p&gt;It was a fun challenge to execute overall.&lt;/p&gt;

&lt;p&gt;Thank You❤️&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>algorithms</category>
      <category>python</category>
    </item>
    <item>
      <title>Palindrome Number</title>
      <dc:creator>Oluwanifemi Latunde</dc:creator>
      <pubDate>Fri, 23 Sep 2022 20:33:59 +0000</pubDate>
      <link>https://dev.to/nifilat/palindrome-number-22bc</link>
      <guid>https://dev.to/nifilat/palindrome-number-22bc</guid>
      <description>&lt;p&gt;Ooof! It's day 3 of the #I4G10DaysOfCodeChallenge and the question was to do a palindrome check on a number without first converting it into a string😪. Today's challenge was kind of tough for me, because I was familiar with first converting to a string to check for palindrome.&lt;/p&gt;

&lt;p&gt;I was only able to solve the challenge with JavaScript this time. &lt;br&gt;
I first did a check to eliminate negative numbers and numbers that ended with zero.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1goygB3j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wf4a542gnyolkw6spoqx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1goygB3j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wf4a542gnyolkw6spoqx.png" alt="JavaScript Solution" width="880" height="470"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then I used some kind of logic to reverse the number as long as the number is greater than zero. And checked if the initial number was equal to the reversed number, or if it was equal to the reversed number divided by 10 for odd numbers.&lt;/p&gt;

&lt;p&gt;I would love if someone could put me through the logic for python.&lt;br&gt;
Below is the link to the challenge &lt;/p&gt;

&lt;p&gt;&lt;a href="https://leetcode.com/problems/palindrome-number/"&gt;https://leetcode.com/problems/palindrome-number/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank you❤️&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>python</category>
      <category>algorithms</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Remove Element</title>
      <dc:creator>Oluwanifemi Latunde</dc:creator>
      <pubDate>Thu, 22 Sep 2022 11:33:04 +0000</pubDate>
      <link>https://dev.to/nifilat/remove-element-2ag7</link>
      <guid>https://dev.to/nifilat/remove-element-2ag7</guid>
      <description>&lt;p&gt;Today is day 2 of the #I4G10DaysOfCodeChallenge and the challenge for today was to remove a specific element from an array or list.&lt;/p&gt;

&lt;p&gt;I solved the challenge using python and JavaScript.&lt;br&gt;
I used the inbuilt remove method for python and the inbuilt splice method for JavaScript.&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%2Fkf2u64p3uege2od91lit.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%2Fkf2u64p3uege2od91lit.png" alt="Image of the solution using Python3"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I looped through each content of the array and did a check to know if the specific number was reached, if it was then it should be removed from the array.&lt;/p&gt;

&lt;p&gt;The splice method of JavaScript can be used if you are aware of the value you wish to delete from an array. You must first determine the target item's index. Then, you start by removing one element while using the index as the start element. To avoid skipping the next member in the array when you wish to remove many elements, simply decrement the index variable.&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%2Fj9wikst3eawkwh0o0lfo.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%2Fj9wikst3eawkwh0o0lfo.png" alt="Image of the solution using JavaScript"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank you.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>algorithms</category>
      <category>python</category>
    </item>
    <item>
      <title>Remove Duplicates from Sorted Array</title>
      <dc:creator>Oluwanifemi Latunde</dc:creator>
      <pubDate>Wed, 21 Sep 2022 20:09:49 +0000</pubDate>
      <link>https://dev.to/nifilat/remove-duplicates-from-sorted-array-55b2</link>
      <guid>https://dev.to/nifilat/remove-duplicates-from-sorted-array-55b2</guid>
      <description>&lt;p&gt;I had been looking for a means to practice data structures and algorithm problems in a healthy competitive environment and I4G's 10 days of coding challenge gave me just the avenue I needed.&lt;/p&gt;

&lt;p&gt;The first challenge was to solve a problem on leetcode to remove duplicates from a sorted array arranged in ascending order.&lt;br&gt;
Below is the link to the challenge&lt;/p&gt;

&lt;p&gt;&lt;a href="https://leetcode.com/problems/remove-duplicates-from-sorted-array/"&gt;https://leetcode.com/problems/remove-duplicates-from-sorted-array/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I solved the challenge using JavaScript and Python.&lt;/p&gt;

&lt;p&gt;My thought process:&lt;/p&gt;

&lt;p&gt;We want to count the total number of unique values in the array. So the first unique value should be placed in the index 0, the second in the index 1 up to the last unique value which would be in the last index.&lt;/p&gt;

&lt;p&gt;We have two pointers to help loop through the array. One for the left and one for the right side of the array. The one on the right scans through the entire array to check for duplicates while the one on the left tells us at what position to put the unique values. The left also tells us how many unique values we have so far, so we increment it by 1.&lt;/p&gt;

&lt;p&gt;Below is the link to my final submission for the challenge: &lt;a href="https://leetcode.com/problems/remove-duplicates-from-sorted-array/submissions/"&gt;https://leetcode.com/problems/remove-duplicates-from-sorted-array/submissions/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>python</category>
      <category>algorithms</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
