First Completely Painted Row or Column | Leetcode 2661

Поділитися
Вставка
  • Опубліковано 31 січ 2025

КОМЕНТАРІ • 23

  • @EugeneTolbakov
    @EugeneTolbakov 11 днів тому

    Just wanted to say thanks for your videos!
    I was stuck on this problem and started watching your explanation and BAM! The idea of a solution clicked.
    This is the third time it's happening!
    आपका बहुत-बहुत धन्यवाद

  • @ali-wz6nz
    @ali-wz6nz 12 днів тому +2

    00:08 - Finding the first index to fully paint a row or column.
    01:52 - Understanding matrix size and unique elements for painting process.
    03:30 - Efficient item searching using a lookup table for matrix coordinates.
    05:07 - Determine first fully painted row or column in a grid.
    06:39 - Explains painting logic for rows and columns using a lookup table.
    08:16 - Identify the first fully painted row or column in a matrix.
    09:54 - Time and space complexity for the algorithm is O(MN).
    11:31 - Storing coordinates and painting rows and columns in a matrix.

    • @techdose4u
      @techdose4u  12 днів тому +1

      nice breakdown 👌🏽

  • @webdeveloper-dv9lj
    @webdeveloper-dv9lj 12 днів тому +2

    Thank you so much.
    Your explanation was really nice and easy to understand.

  • @rishabhverma3257
    @rishabhverma3257 11 днів тому +1

    nice explaination sir!!

  • @jigyarthjoshi6002
    @jigyarthjoshi6002 11 днів тому +1

    At the end of the code, instead of return 0, you should return m*n-1, because ideally it will be the last index which will paint the whole matrix, not the 0th index.
    Anyways we will not reach the case as the elements are in range 0,m*n so definitely be painted.

    • @techdose4u
      @techdose4u  11 днів тому +2

      returning any number will not affect anything because every cell is painted in loop.
      I would rather remove the return statement if I can :)

  • @themer00pesh45
    @themer00pesh45 12 днів тому +1

    thanky you 💞💞

  • @SainathLatkar
    @SainathLatkar 12 днів тому +1

    Thank you Sir!

  • @sailendrachettri8521
    @sailendrachettri8521 11 днів тому

    Thank you sir :)

  • @prashantkumarsingh1070
    @prashantkumarsingh1070 11 днів тому

    sir please try to take contest question as well. It will be very helpful to us.

    • @techdose4u
      @techdose4u  11 днів тому

      Not finding time else will take in future for sure

  • @nitheeshp.s2532
    @nitheeshp.s2532 11 днів тому

    sir why do we compare row count == n and col count==m my cases passed only this way.. it should the other way around right could u pls explain

    • @louisuchihatm2556
      @louisuchihatm2556 11 днів тому

      We want to check if items in row1 are painted. Say row1 has [2, 4, 7] elements. 2 is painted, therefore we check if the next item in row1 is painted. That'll be 4.
      2 -> 4 -> 7
      To check if a row is fully painted, we are traversing through its columns hence we check the size of that row's column (n) (row_count == n).

    • @JaipalReddyYerram
      @JaipalReddyYerram 11 днів тому

      when row_count == n that means that row is fully printed and similarly when col_count == m that means that col is fully printed here n, m are no of rows and cols

    • @techdose4u
      @techdose4u  11 днів тому

      Thanks for your answer guys

  • @AravindKumar-v9k
    @AravindKumar-v9k 11 днів тому

    Thank yu isr. Can you please help me to find the space complexity of my program below ..
    class Solution {
    public int firstCompleteIndex(int[] arr, int[][] mat) {
    Mapmap=new HashMap();
    for(int i=0;i