Search a 2D Matrix II | LeetCode 240 | Matrix

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 พ.ย. 2024

ความคิดเห็น • 14

  • @yashwants18
    @yashwants18 ปีที่แล้ว +1

    How did you come up with the O(m+n) solution? I mean how you got to know where to start the pointer?

  • @manyagupta8679
    @manyagupta8679 11 หลายเดือนก่อน

    What an explanation!!!!.........Thank you sir

  • @Ayush479
    @Ayush479 ปีที่แล้ว +2

    why can't we apply binary serach on this question similar to the search the matrix question

    • @OssamaAmer
      @OssamaAmer ปีที่แล้ว

      Because the entire matrix isn't sorted

  • @NareshGupta
    @NareshGupta  3 ปีที่แล้ว

    Matrix Problem Playlist - th-cam.com/play/PLamEquLLzOtjEph8ZqcTOt0tCEfj4PZfy.html

  • @sharuk3545
    @sharuk3545 3 ปีที่แล้ว

    awesomee

  • @adil6873
    @adil6873 3 ปีที่แล้ว +1

    Can you please start live session of leetcode problems from tomorrow at particular time ?

    • @NareshGupta
      @NareshGupta  3 ปีที่แล้ว +1

      Finding time every day at dedicated time is very tuff as currently involved in multiple things. You contact me if you need any help on any specific problem.

  • @Tarunkumar-gs4mm
    @Tarunkumar-gs4mm 3 ปีที่แล้ว

    class Solution {
    public boolean searchMatrix(int[][] matrix, int target) {
    int m=matrix.length;
    int n=matrix[0].length;
    int row=0,col=n-1;
    if(matrix[row][col]==target)
    return true;
    while(row=0)
    {
    if(matrix[row][col]

    • @Tarunkumar-gs4mm
      @Tarunkumar-gs4mm 3 ปีที่แล้ว

      i tried submitting this code but it show error

    • @NareshGupta
      @NareshGupta  3 ปีที่แล้ว +1

      check condition in ur while loop. Why row < col ?

    • @Tarunkumar-gs4mm
      @Tarunkumar-gs4mm 3 ปีที่แล้ว

      @@NareshGupta thanks man!!
      sometimes silly mistakes just ruin your day
      that what happened with me

    • @NareshGupta
      @NareshGupta  3 ปีที่แล้ว +1

      @@Tarunkumar-gs4mm ya it can happen with anyone anytime but one should learn from mistakes now try to make habit to double check all conditions and try to simulate and dry run 1-2 test-cases.

    • @Tarunkumar-gs4mm
      @Tarunkumar-gs4mm 3 ปีที่แล้ว

      @@NareshGupta yaah thanks for advice