<?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: ishwar kokkili</title>
    <description>The latest articles on DEV Community by ishwar kokkili (@ikokkili).</description>
    <link>https://dev.to/ikokkili</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%2F473366%2F9a2a5a1f-0e70-4ce6-8ee3-060f25dd0c47.jpg</url>
      <title>DEV Community: ishwar kokkili</title>
      <link>https://dev.to/ikokkili</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ikokkili"/>
    <language>en</language>
    <item>
      <title>Day 2 - Valid Parentheses</title>
      <dc:creator>ishwar kokkili</dc:creator>
      <pubDate>Tue, 24 May 2022 14:47:11 +0000</pubDate>
      <link>https://dev.to/ikokkili/day-2-valid-parentheses-3elc</link>
      <guid>https://dev.to/ikokkili/day-2-valid-parentheses-3elc</guid>
      <description>&lt;p&gt;-&amp;gt; Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.&lt;/p&gt;

&lt;p&gt;An input string is valid if:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Open brackets must be closed by the same type of brackets.
Open brackets must be closed in the correct order.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Eg -&amp;gt; &lt;/p&gt;

&lt;p&gt;Input: s = "()"&lt;br&gt;
Output: true&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:
    def isValid(self, s: str) -&amp;gt; bool:
        stack =[]
        for i in s: 
            if i == "(" or i == "{" or i == "[" : 
                stack.append(i)
            elif i == ")" : 
                if stack and stack[-1]=="(": 
                     stack.pop()
                else: 
                    stack.append(i)
            elif i == "}" : 
                if stack and stack[-1]=="{": 
                    stack.pop()
                else: 
                    stack.append(i)
            elif i == "]" : 
                if stack and stack[-1]=="[": 
                    stack.pop()
                else: 
                    stack.append(i)

        if stack:
            return False 
        else: 
            return True


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

&lt;/div&gt;



</description>
      <category>python</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>Recursion - Own Power function</title>
      <dc:creator>ishwar kokkili</dc:creator>
      <pubDate>Fri, 20 May 2022 18:14:06 +0000</pubDate>
      <link>https://dev.to/ikokkili/recursion-own-power-function-4hh4</link>
      <guid>https://dev.to/ikokkili/recursion-own-power-function-4hh4</guid>
      <description>&lt;p&gt;In this post I'm going to write my own power function in python which will perform like pow(x,n) in Py3&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Power function using recursion -&amp;gt; 

def power(num,exp):
    if exp==1: 
        return num 
    return num*power(num,exp-1)

print(f"The value is {power(5,3)})

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

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;output - &lt;br&gt;
The value is 125&lt;/code&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>recursion</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Python - Leetcode : Day 1</title>
      <dc:creator>ishwar kokkili</dc:creator>
      <pubDate>Fri, 20 May 2022 17:43:28 +0000</pubDate>
      <link>https://dev.to/ikokkili/python-leetcode-day-1-2e05</link>
      <guid>https://dev.to/ikokkili/python-leetcode-day-1-2e05</guid>
      <description>&lt;p&gt;leetcode -&amp;gt; 344 -reverse string &lt;/p&gt;

&lt;h2&gt;
  
  
  344 - Reverse string -
&lt;/h2&gt;

&lt;p&gt;Write a function that reverses a string. The input string is given as an array of characters s.&lt;/p&gt;

&lt;p&gt;You must do this by modifying the input array in-place with O(1) extra memory&lt;/p&gt;

&lt;p&gt;sol 1 - Pattern 'Stack' - Using a stack DS , but it uses O(N) extra memory. &lt;/p&gt;

&lt;p&gt;sol 2 - 2 Pointer Approach - Using Two Pointers there is no need of Extra Memory &lt;br&gt;
time complexity -O(N)&lt;br&gt;
space complexity -O(1)&lt;/p&gt;

&lt;h2&gt;
  
  
  Code -
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Solution:   
    def reverseString(self, s: List[str]) -&amp;gt; None:
        """
        Do not return anything, modify s in-place instead.
        """
        i,j =0,len(s)-1
        while i&amp;lt;j : 
            s[i],s[j]=s[j],s[i]
            i+=1 
            j-=1
        return s 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>leetcode</category>
      <category>python</category>
    </item>
  </channel>
</rss>
