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! आपका बहुत-बहुत धन्यवाद
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.
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.
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).
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
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
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!
आपका बहुत-बहुत धन्यवाद
wowww great 😊
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.
nice breakdown 👌🏽
Thank you so much.
Your explanation was really nice and easy to understand.
Glad it helped. 👍🏼
nice explaination sir!!
thanks
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.
returning any number will not affect anything because every cell is painted in loop.
I would rather remove the return statement if I can :)
thanky you 💞💞
Welcome :)
Thank you Sir!
welcome :)
Thank you sir :)
Welcome
sir please try to take contest question as well. It will be very helpful to us.
Not finding time else will take in future for sure
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
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).
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
Thanks for your answer guys
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