Leetcode 36 Valid Sudoku | Deducing the formula

preview_player
Показать описание
Leetcode 36. Valid Sudoku Hindi
36. Valid Sudoku Leetcode Hindi
Leetcode 36. Valid Sudoku
36. Valid Sudoku
Valid Sudoku leetcode
leetcode Valid Sudoku

#hashmap #begineerfriendly

🔴 Do check out my channel for "Daily Leetcode Challenges" and playlists for "DSA and leetcode contests" :

Weekly Contest 297 playlist:

Weekly Contest 296 playlist:

leetcode 1091 Shortest Path in Binary Matrix:
Given an n x n binary matrix grid, return the length of the shortest clear path in the matrix. If there is no clear path, return -1.

Gadgets I use:
For my coding videos:
Рекомендации по теме
Комментарии
Автор

Please like, comment and subscribe !! Dont forget to subscribe !!

Think_Code
Автор

Hi, I have one doubt. Is scaler academy worth it? what do you think as microsoft Engineer?? the salesmen are after me and even im confused.

sharathkumar
Автор

I don't understand why you need three loops to do the same thing.
Instead combine everything into a single loop.
BTW, Nice video and your explanation is lit.
Can we connect on linkedin. What's the username there?

class Solution {
public:
bool board) {
vector<unordered_map<char, int>> row(9);
vector<unordered_map<char, int>> col(9);
vector<unordered_map<char, int>> box(9);

for(int i=0; i<9; i++) {
for(int j=0; j<9; j++) {
if(board[i][j] != '.') {
row[i][board[i][j]]++;
col[j][board[i][j]]++;
int k = (i/3)*3 + j/3;
box[k][board[i][j]]++;

if(row[i][board[i][j]] > 1)
return false;
if(col[j][board[i][j]] > 1)
return false;
if(box[k][board[i][j]] > 1)
return false;
}
}
}

return true;
}
};

ShubhamPatil-igqe
join shbcf.ru