<?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: Shakeeb Shahid</title>
    <description>The latest articles on DEV Community by Shakeeb Shahid (@shaksy_boy).</description>
    <link>https://dev.to/shaksy_boy</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%2F702479%2Fb799c8bc-8bb9-4369-8499-ece56046ffae.jpeg</url>
      <title>DEV Community: Shakeeb Shahid</title>
      <link>https://dev.to/shaksy_boy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shaksy_boy"/>
    <language>en</language>
    <item>
      <title>Shakeeb's Algorithm to reverse a number. Crisp and very logical. Dont memorise 😂😂😁</title>
      <dc:creator>Shakeeb Shahid</dc:creator>
      <pubDate>Mon, 28 Mar 2022 15:54:42 +0000</pubDate>
      <link>https://dev.to/shaksy_boy/shakeebs-algorithm-to-reverse-a-number-crisp-and-very-logical-dont-memorise-45nd</link>
      <guid>https://dev.to/shaksy_boy/shakeebs-algorithm-to-reverse-a-number-crisp-and-very-logical-dont-memorise-45nd</guid>
      <description>&lt;p&gt;`#include&lt;br&gt;
using namespace std;&lt;br&gt;
int reverse(int n)&lt;br&gt;
{&lt;br&gt;
    //Count numbers first&lt;br&gt;
    int count = 0;&lt;br&gt;
    int orig = n;&lt;br&gt;
    while(n&amp;gt;0)&lt;br&gt;
    {&lt;br&gt;
        count++;&lt;br&gt;
        n=n/10;&lt;br&gt;
    }&lt;br&gt;
    //REVERSE USING PLACE VALUES;&lt;br&gt;
    //Input: 345&lt;br&gt;
    //3 becomes unit, 4 becomes 10 and 5 becomes 100th&lt;br&gt;
    //Basically reversing the place value;&lt;br&gt;
    int pv = count;&lt;br&gt;
    int rem =0;&lt;br&gt;
    int newPlaceValue;&lt;br&gt;
    int rev= 0;&lt;br&gt;
    while(pv&amp;gt;=0 &amp;amp;&amp;amp; orig&amp;gt;=0)&lt;br&gt;
    {&lt;br&gt;&lt;br&gt;
        rem = orig%10; &lt;br&gt;
        rev = rev  + (rem*pow(10, pv));&lt;br&gt;
        orig=orig/10;&lt;br&gt;
        pv--;&lt;br&gt;&lt;br&gt;
    }&lt;br&gt;
    return rev=rev/10;&lt;/p&gt;

&lt;p&gt;}&lt;br&gt;
int main()&lt;br&gt;
{&lt;br&gt;
    int n;&lt;br&gt;
    cin&amp;gt;&amp;gt;n;&lt;br&gt;
    int answer = reverse(n);&lt;br&gt;
    cout &amp;lt;&amp;lt; answer;&lt;br&gt;
}&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Okay, so you might be wondering why this big chunk of code just to reverse a number... why not the regular conservative way to do it... Basically I want to show that mugging up and writting/copying things is a waste of time..Enuf of the pep talk lets get into the solution description......&lt;br&gt;
You need to have knowledge about place values of a given number....if you see all you are doing is reversing the place values backwards therefore do so.......&lt;br&gt;
`&lt;/p&gt;
&lt;/blockquote&gt;

</description>
    </item>
    <item>
      <title>Reversing a string but word wise! using char array. No string library.</title>
      <dc:creator>Shakeeb Shahid</dc:creator>
      <pubDate>Fri, 26 Nov 2021 13:31:15 +0000</pubDate>
      <link>https://dev.to/shaksy_boy/reversing-a-string-but-word-wise-using-char-array-no-string-library-17a</link>
      <guid>https://dev.to/shaksy_boy/reversing-a-string-but-word-wise-using-char-array-no-string-library-17a</guid>
      <description>&lt;ul&gt;
&lt;li&gt;Input: &lt;strong&gt;Reverse this word&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Output: &lt;strong&gt;word this Reverse&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&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;cstring&amp;gt;
using namespace std;

void reverseStringWordWise(char input[]) {
    // Write your code here
    int sp = strlen(input);
    int o_size = sp;
     char output[sp];
    int p = sp;
    int j = sp-1;
    int i=0;
    while(j&amp;gt;=0 || j==-1) // Since the first word will not have any space before it So it wont count
    {

        if(input[j]==' ' ||j==-1)
        {
            for(int k = j+1; k&amp;lt;p;k++) // j gets iterated from -1 to 0. Thus giving the frist word upto the the last space traced.
            {
                output[i++] = input[k];
            }
             p = j;
             j--;

            output[i++] = ' ';
        }
        else
        {
            j--;
        }

    }
  for(int l=0;l&amp;lt;sp;l++)
  {
      input[l] = output[l];
  }
}


int main() {
    char input[1000];
    cin.getline(input, 1000);
    reverseStringWordWise(input);
    cout &amp;lt;&amp;lt; input &amp;lt;&amp;lt; endl;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>programming</category>
      <category>algorithms</category>
      <category>cpp</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Using continue keyword to convert binary to decimal. No use of array, string or any pre-defined conversion. Complexity O(log n)</title>
      <dc:creator>Shakeeb Shahid</dc:creator>
      <pubDate>Tue, 02 Nov 2021 14:10:24 +0000</pubDate>
      <link>https://dev.to/shaksy_boy/using-continue-keyword-to-convert-binary-to-decimal-no-use-of-array-string-or-any-pre-defined-conversion-35e9</link>
      <guid>https://dev.to/shaksy_boy/using-continue-keyword-to-convert-binary-to-decimal-no-use-of-array-string-or-any-pre-defined-conversion-35e9</guid>
      <description>&lt;p&gt;So this post is just to show a different approach to convert binary to decimal.&lt;br&gt;
I would like the community to make this code better in terms of complexity. If possible 😜😝&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;math.h&amp;gt;
using namespace std;
int main()
{

    int n;
    cin &amp;gt;&amp;gt; n;
    int count=0;
    int sum =0;
    for(int i=n;i&amp;gt;0;i=i/10)
    {
       int rem = i%10;
        if(rem==0)
        {
            count =count +1;
            continue;
        }
        else if(rem==1)
        sum = sum + pow(2,count);
        count =count+1;
    }
    cout &amp;lt;&amp;lt; sum &amp;lt;&amp;lt;endl;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Time Complexity : O(log  n)&lt;br&gt;
Correct me guys if I'm wrong!&lt;br&gt;
Thanks.....&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
