<?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: SaiPavan Seelamsetty</title>
    <description>The latest articles on DEV Community by SaiPavan Seelamsetty (@saipavan_seelamsetty).</description>
    <link>https://dev.to/saipavan_seelamsetty</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%2F834574%2Fbb39c61b-1205-4115-b0b5-a03f9445b0bf.png</url>
      <title>DEV Community: SaiPavan Seelamsetty</title>
      <link>https://dev.to/saipavan_seelamsetty</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/saipavan_seelamsetty"/>
    <language>en</language>
    <item>
      <title>Insertion Sort - Python</title>
      <dc:creator>SaiPavan Seelamsetty</dc:creator>
      <pubDate>Mon, 04 Apr 2022 05:05:10 +0000</pubDate>
      <link>https://dev.to/saipavan_seelamsetty/insertion-sort-python-1k8c</link>
      <guid>https://dev.to/saipavan_seelamsetty/insertion-sort-python-1k8c</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Erip_7s4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uz1t04558lk7sm14cdo4.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Erip_7s4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uz1t04558lk7sm14cdo4.PNG" alt="Image description" width="639" height="369"&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;def insertionSort(array):
    # Write your code here.
    for i in range(1,len(array)):
        j=i
        while j&amp;gt;0 and array[j]&amp;lt;array[j-1]:
            swap(j,j-1,array)
            j-=1
    return array        
def swap(i,j,array):
    array[i],array[j]=array[j],array[i]

#TC=O(n^2)  SC = O(1)  - Saipavan Seelamsetty
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>insertionsort</category>
      <category>sorting</category>
      <category>python</category>
    </item>
    <item>
      <title>Search in Rotated Sorted Array - Python</title>
      <dc:creator>SaiPavan Seelamsetty</dc:creator>
      <pubDate>Sat, 26 Mar 2022 07:18:42 +0000</pubDate>
      <link>https://dev.to/saipavan_seelamsetty/search-in-rotated-sorted-array-python-2hod</link>
      <guid>https://dev.to/saipavan_seelamsetty/search-in-rotated-sorted-array-python-2hod</guid>
      <description>&lt;p&gt;There is an integer array nums sorted in ascending order (with distinct values).&lt;/p&gt;

&lt;p&gt;Prior to being passed to your function, nums is possibly rotated at an unknown pivot index k (1 &amp;lt;= k &amp;lt; nums.length) such that the resulting array is &lt;a href="https://dev.to0-indexed"&gt;nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nums[k-1]&lt;/a&gt;. For example, [0,1,2,4,5,6,7] might be rotated at pivot index 3 and become [4,5,6,7,0,1,2].&lt;/p&gt;

&lt;p&gt;Given the array nums after the possible rotation and an integer target, return the index of target if it is in nums, or -1 if it is not in nums.&lt;/p&gt;

&lt;p&gt;You must write an algorithm with O(log n) runtime complexity.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://leetcode.com/problems/search-in-rotated-sorted-array/"&gt;https://leetcode.com/problems/search-in-rotated-sorted-array/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Example 1:&lt;/p&gt;

&lt;p&gt;Input: nums = [4,5,6,7,0,1,2], target = 0&lt;br&gt;
Output: 4&lt;br&gt;
Example 2:&lt;/p&gt;

&lt;p&gt;Input: nums = [4,5,6,7,0,1,2], target = 3&lt;br&gt;
Output: -1&lt;br&gt;
Example 3:&lt;/p&gt;

&lt;p&gt;Input: nums = [1], target = 0&lt;br&gt;
Output: -1&lt;/p&gt;

&lt;p&gt;Constraints:&lt;/p&gt;

&lt;p&gt;1 &amp;lt;= nums.length &amp;lt;= 5000&lt;br&gt;
-104 &amp;lt;= nums[i] &amp;lt;= 104&lt;br&gt;
All values of nums are unique.&lt;br&gt;
nums is an ascending array that is possibly rotated.&lt;br&gt;
-104 &amp;lt;= target &amp;lt;= 104&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 search(self, nums: List[int], target: int) -&amp;gt; int:
        #TC=O(log n)
        s=0
        e=len(nums)-1
        while s&amp;lt;=e:
            mid=(s+e)//2
            if nums[mid]==target:
                return mid
           #left-line
            if nums[s]&amp;lt;=nums[mid]:
                if target&amp;gt;=nums[s] and target&amp;lt;=nums[mid]:
                    e=mid-1
                else:
                    s=mid+1
            else:
                if target&amp;gt;=nums[mid] and target&amp;lt;=nums[e]:
                    s=mid+1
                else:
                    e=mid-1
        return -1     
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>leetcode</category>
      <category>dsa</category>
      <category>python</category>
      <category>saipavan</category>
    </item>
    <item>
      <title>Find First and Last Position of Element in Sorted Array - Python</title>
      <dc:creator>SaiPavan Seelamsetty</dc:creator>
      <pubDate>Sat, 26 Mar 2022 06:30:13 +0000</pubDate>
      <link>https://dev.to/saipavan_seelamsetty/find-first-and-last-position-of-element-in-sorted-array-python-4moi</link>
      <guid>https://dev.to/saipavan_seelamsetty/find-first-and-last-position-of-element-in-sorted-array-python-4moi</guid>
      <description>&lt;p&gt;Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value.&lt;/p&gt;

&lt;p&gt;If target is not found in the array, return [-1, -1].&lt;/p&gt;

&lt;p&gt;You must write an algorithm with O(log n) runtime complexity.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/"&gt;https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Example 1:&lt;/p&gt;

&lt;p&gt;Input: nums = [5,7,7,8,8,10], target = 8&lt;br&gt;
Output: [3,4]&lt;br&gt;
Example 2:&lt;/p&gt;

&lt;p&gt;Input: nums = [5,7,7,8,8,10], target = 6&lt;br&gt;
Output: [-1,-1]&lt;br&gt;
Example 3:&lt;/p&gt;

&lt;p&gt;Input: nums = [], target = 0&lt;br&gt;
Output: [-1,-1]&lt;/p&gt;

&lt;p&gt;Constraints:&lt;/p&gt;

&lt;p&gt;0 &amp;lt;= nums.length &amp;lt;= 105&lt;br&gt;
-109 &amp;lt;= nums[i] &amp;lt;= 109&lt;br&gt;
nums is a non-decreasing array.&lt;br&gt;
-109 &amp;lt;= target &amp;lt;= 109&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    def searchRange(self, numbers: List[int], target: int) -&amp;gt; List[int]:
        result=[-1,-1]
        l=0
        h=len(numbers)-1
        while l&amp;lt;=h:
            mid=(l+h)//2
            if target&amp;gt;numbers[mid]:
                l=mid+1
            elif target&amp;lt;numbers[mid]:
                h=mid-1
            else:
                result[0]=mid
                h=mid-1
        l=0
        h=len(numbers)-1
        while l&amp;lt;=h:
            mid=(l+h)//2
            if target&amp;gt;numbers[mid]:
                l=mid+1
            elif target&amp;lt;numbers[mid]:
                h=mid-1
            else:
                result[1]=mid
                l=mid+1
        return result   


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

&lt;/div&gt;



</description>
      <category>leetcode</category>
      <category>python</category>
      <category>dsa</category>
      <category>saipavan</category>
    </item>
    <item>
      <title>LeetCode in Python - Day 1</title>
      <dc:creator>SaiPavan Seelamsetty</dc:creator>
      <pubDate>Fri, 25 Mar 2022 17:25:22 +0000</pubDate>
      <link>https://dev.to/saipavan_seelamsetty/day-175-leetcode-python-45e6</link>
      <guid>https://dev.to/saipavan_seelamsetty/day-175-leetcode-python-45e6</guid>
      <description>&lt;ol&gt;
&lt;li&gt;&lt;a href="https://leetcode.com/problems/two-sum/"&gt;https://leetcode.com/problems/two-sum/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://leetcode.com/problems/best-time-to-buy-and-sell-stock/"&gt;https://leetcode.com/problems/best-time-to-buy-and-sell-stock/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://leetcode.com/problems/plus-one/"&gt;https://leetcode.com/problems/plus-one/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://leetcode.com/problems/move-zeroes/"&gt;https://leetcode.com/problems/move-zeroes/&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;1. Two Sum&lt;/strong&gt;&lt;br&gt;
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.&lt;/p&gt;

&lt;p&gt;You may assume that each input would have exactly one solution, and you may not use the same element twice.&lt;/p&gt;

&lt;p&gt;You can return the answer in any order.&lt;/p&gt;

&lt;p&gt;Example 1:&lt;/p&gt;

&lt;p&gt;Input: nums = [2,7,11,15], target = 9&lt;br&gt;
Output: [0,1]&lt;br&gt;
Explanation: Because nums[0] + nums[1] == 9, we return [0, 1].&lt;br&gt;
Example 2:&lt;/p&gt;

&lt;p&gt;Input: nums = [3,2,4], target = 6&lt;br&gt;
Output: [1,2]&lt;br&gt;
Example 3:&lt;/p&gt;

&lt;p&gt;Input: nums = [3,3], target = 6&lt;br&gt;
Output: [0,1]&lt;/p&gt;

&lt;p&gt;Constraints:&lt;/p&gt;

&lt;p&gt;2 &amp;lt;= nums.length &amp;lt;= 104&lt;br&gt;
-109 &amp;lt;= nums[i] &amp;lt;= 109&lt;br&gt;
-109 &amp;lt;= target &amp;lt;= 109&lt;br&gt;
Only one valid answer exists.&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 twoSum(self, nums: List[int], target: int) -&amp;gt; List[int]:
        #BruteForce

        for i in range(len(nums)):
            for j in range(i+1,len(nums)):
                if nums[i]+nums[j]==target:
                    return [i,j]
        return [-1,-1]      

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

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Solution:
    def twoSum(self, nums: List[int], target: int) -&amp;gt; List[int]:
        #optimal----&amp;gt;TC O(N)-----&amp;gt;SC=O(N)
        pair_check={}
        count=0
        for i in range(len(nums)):
            b=target-nums[i]
            if b  in pair_check:
                return[pair_check[b],i]
            else:
                pair_check[nums[i]]=i
        return []        
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2.Best Time to Buy and Sell Stock&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You are given an array prices where prices[i] is the price of a given stock on the ith day.&lt;/p&gt;

&lt;p&gt;You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock.&lt;/p&gt;

&lt;p&gt;Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0.&lt;/p&gt;

&lt;p&gt;Example 1:&lt;/p&gt;

&lt;p&gt;Input: prices = [7,1,5,3,6,4]&lt;br&gt;
Output: 5&lt;br&gt;
Explanation: Buy on day 2 (price = 1) and sell on day 5 (price = 6), profit = 6-1 = 5.&lt;br&gt;
Note that buying on day 2 and selling on day 1 is not allowed because you must buy before you sell.&lt;br&gt;
Example 2:&lt;/p&gt;

&lt;p&gt;Input: prices = [7,6,4,3,1]&lt;br&gt;
Output: 0&lt;br&gt;
Explanation: In this case, no transactions are done and the max profit = 0.&lt;/p&gt;

&lt;p&gt;Constraints:&lt;/p&gt;

&lt;p&gt;1 &amp;lt;= prices.length &amp;lt;= 105&lt;br&gt;
0 &amp;lt;= prices[i] &amp;lt;= 104&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 maxProfit(self, prices: List[int]) -&amp;gt; int:
        #TC---&amp;gt;O(N)  SC---&amp;gt;O(1)
        buy=prices[0]
        profit=0
        for i in range(1,len(prices)):
            diff=prices[i]-buy
            buy=min(buy,prices[i])
            profit=max(profit,diff)
        return profit  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Plus One&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You are given a large integer represented as an integer array digits, where each digits[i] is the ith digit of the integer. The digits are ordered from most significant to least significant in left-to-right order. The large integer does not contain any leading 0's.&lt;/p&gt;

&lt;p&gt;Increment the large integer by one and return the resulting array of digits.&lt;/p&gt;

&lt;p&gt;Example 1:&lt;/p&gt;

&lt;p&gt;Input: digits = [1,2,3]&lt;br&gt;
Output: [1,2,4]&lt;br&gt;
Explanation: The array represents the integer 123.&lt;br&gt;
Incrementing by one gives 123 + 1 = 124.&lt;br&gt;
Thus, the result should be [1,2,4].&lt;br&gt;
Example 2:&lt;/p&gt;

&lt;p&gt;Input: digits = [4,3,2,1]&lt;br&gt;
Output: [4,3,2,2]&lt;br&gt;
Explanation: The array represents the integer 4321.&lt;br&gt;
Incrementing by one gives 4321 + 1 = 4322.&lt;br&gt;
Thus, the result should be [4,3,2,2].&lt;br&gt;
Example 3:&lt;/p&gt;

&lt;p&gt;Input: digits = [9]&lt;br&gt;
Output: [1,0]&lt;br&gt;
Explanation: The array represents the integer 9.&lt;br&gt;
Incrementing by one gives 9 + 1 = 10.&lt;br&gt;
Thus, the result should be [1,0].&lt;/p&gt;

&lt;p&gt;Constraints:&lt;/p&gt;

&lt;p&gt;1 &amp;lt;= digits.length &amp;lt;= 100&lt;br&gt;
0 &amp;lt;= digits[i] &amp;lt;= 9&lt;br&gt;
digits does not contain any leading 0's.&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 plusOne(self, digits: List[int]) -&amp;gt; List[int]:
        #TC---&amp;gt;O(N)  SC----&amp;gt;O(1)
        dig_len=len(digits)
        for i in reversed(range(dig_len)):
            digits[i]+=1
            if digits[i]&amp;lt;10:
                return digits
            else:
                digits[i]=0
        digits.insert(0,1)
        return digits

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. Move Zeroes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Given an integer array nums, move all 0's to the end of it while maintaining the relative order of the non-zero elements.&lt;/p&gt;

&lt;p&gt;Note that you must do this in-place without making a copy of the array.&lt;/p&gt;

&lt;p&gt;Example 1:&lt;/p&gt;

&lt;p&gt;Input: nums = [0,1,0,3,12]&lt;br&gt;
Output: [1,3,12,0,0]&lt;br&gt;
Example 2:&lt;/p&gt;

&lt;p&gt;Input: nums = [0]&lt;br&gt;
Output: [0]&lt;/p&gt;

&lt;p&gt;Constraints:&lt;/p&gt;

&lt;p&gt;1 &amp;lt;= nums.length &amp;lt;= 104&lt;br&gt;
-231 &amp;lt;= nums[i] &amp;lt;= 231 - 1&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 moveZeroes(self, nums: List[int]) -&amp;gt; None:
        #TC=O(N) SC=O(1)
        """
        Do not return anything, modify nums in-place instead.
        """
        prev_index=0
        for i in range(len(nums)):
            if nums[i]!=0:
                nums[i],nums[prev_index]=nums[prev_index],nums[i]
                prev_index+=1

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

&lt;/div&gt;



&lt;p&gt;Appreciate your feedback for Improvements by Saipavan Seelamsetty&lt;/p&gt;

</description>
      <category>twosum</category>
      <category>plusone</category>
      <category>movezeroes</category>
      <category>stockbuysell</category>
    </item>
    <item>
      <title>[Leetcode]1552. Magnetic Force Between Two Balls - Python Solution</title>
      <dc:creator>SaiPavan Seelamsetty</dc:creator>
      <pubDate>Tue, 22 Mar 2022 05:13:00 +0000</pubDate>
      <link>https://dev.to/saipavan_seelamsetty/leetcode1552-magnetic-force-between-two-balls-python-solution-52n4</link>
      <guid>https://dev.to/saipavan_seelamsetty/leetcode1552-magnetic-force-between-two-balls-python-solution-52n4</guid>
      <description>&lt;p&gt;In the universe Earth C-137, Rick discovered a special form of magnetic force between two balls if they are put in his new invented basket. Rick has n empty baskets, the ith basket is at position[i], Morty has m balls and needs to distribute the balls into the baskets such that the minimum magnetic force between any two balls is maximum.&lt;/p&gt;

&lt;p&gt;Rick stated that magnetic force between two different balls at positions x and y is |x - y|.&lt;/p&gt;

&lt;p&gt;Given the integer array position and the integer m. Return the required force.&lt;/p&gt;

&lt;p&gt;Example 1:&lt;/p&gt;

&lt;p&gt;Input: position = [1,2,3,4,7], m = 3&lt;br&gt;
Output: 3&lt;br&gt;
Explanation: Distributing the 3 balls into baskets 1, 4 and 7 will make the magnetic force between ball pairs [3, 3, 6]. The minimum magnetic force is 3. We cannot achieve a larger minimum magnetic force than 3.&lt;br&gt;
Example 2:&lt;/p&gt;

&lt;p&gt;Input: position = [5,4,3,2,1,1000000000], m = 2&lt;br&gt;
Output: 999999999&lt;br&gt;
Explanation: We can use baskets 1 and 1000000000.&lt;/p&gt;

&lt;p&gt;Constraints:&lt;/p&gt;

&lt;p&gt;n == position.length&lt;br&gt;
2 &amp;lt;= n &amp;lt;= 105&lt;br&gt;
1 &amp;lt;= position[i] &amp;lt;= 109&lt;br&gt;
All integers in position are distinct.&lt;br&gt;
2 &amp;lt;= m &amp;lt;= position.length&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 maxDistance(self, position: List[int], m: int) -&amp;gt; int:
        position.sort()
        start=0
        end=position[-1]
        n=len(position)
        ans=0
        while start&amp;lt;=end:
            mid=(start+end)//2
            if(self.gapisenough(position,mid,m)):
                ans=mid
                start=mid+1
            else:
                end=mid-1
        return ans
    def gapisenough(self,position,mid,m):
        initial=1
        prev=position[0]
        for i in range(1,len(position)):
            if(position[i]-prev&amp;gt;=mid):
                initial+=1
                prev=position[i]
                if(initial==m):
                    return True
        if(initial&amp;lt;m):
            return False


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

&lt;/div&gt;



</description>
      <category>binarysearch</category>
      <category>leetcode</category>
      <category>dsa</category>
      <category>python</category>
    </item>
    <item>
      <title>[Leetcode]74. Search a 2D Matrix - Python Solution</title>
      <dc:creator>SaiPavan Seelamsetty</dc:creator>
      <pubDate>Tue, 22 Mar 2022 04:08:07 +0000</pubDate>
      <link>https://dev.to/saipavan_seelamsetty/leetcode74-search-a-2d-matrix-python-solution-5cie</link>
      <guid>https://dev.to/saipavan_seelamsetty/leetcode74-search-a-2d-matrix-python-solution-5cie</guid>
      <description>&lt;h2&gt;
  
  
  Write an efficient algorithm that searches for a value target in an m x n integer matrix matrix. This matrix has the following properties:
&lt;/h2&gt;

&lt;p&gt;Integers in each row are sorted from left to right.&lt;br&gt;
The first integer of each row is greater than the last integer of the previous row.&lt;/p&gt;

&lt;p&gt;Example 1:&lt;/p&gt;

&lt;p&gt;Input: matrix = [[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 3&lt;br&gt;
Output: true&lt;br&gt;
Example 2:&lt;/p&gt;

&lt;p&gt;Input: matrix = [[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 13&lt;br&gt;
Output: false&lt;/p&gt;

&lt;p&gt;Constraints:&lt;/p&gt;

&lt;p&gt;m == matrix.length&lt;br&gt;
n == matrix[i].length&lt;br&gt;
1 &amp;lt;= m, n &amp;lt;= 100&lt;br&gt;
-104 &amp;lt;= matrix[i][j], target &amp;lt;= 104&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 searchMatrix(self, matrix: List[List[int]], target: int) -&amp;gt; bool:
        n=len(matrix)*len(matrix[0])
        start=0
        end=n-1
        while start&amp;lt;=end:
            mid=(start+end)//2
            row=mid//len(matrix[0])
            column=mid%len(matrix[0])
            if matrix[row][column]==target:
                return True
            elif matrix[row][column]&amp;gt;target:
                end-=1
            else:
                start+=1
        return False        

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

&lt;/div&gt;



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