NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

/**
* @param {character[][]} board
* @return {boolean}
*/
var isValidSudoku = function(board) {
// Sure
// So, I'm thinking we identify the edge cases, like no number must repeat along each array board[i], each row

// CASE 1: check if each row in board[i] is valid
// CASE 2: Check if every column is valid
const columns = []
const cells = []

for (var i = 0; i < board.length; i++) {
const nums = [] // store the numbers in every row as we iterate
for (var j = 0; board[i].length; j++) {
if (nums.includes(board[i][j])) return false;
if (columns[j].includes(board[i][j])) return false;

// My intuition is to mind the bottom-right total index of each cell and see if we can map it to the cell number
cells[0] => 2 x 2 = 4
cells[1] => 5 x 2 = 10
cells[2] => 8 x 2 = 16
cells[3] => 2 x 5 = 10
cells[4] => 5 x 5 = 25
cells[5] => 8 x 5 = 40
I'm not seeing an easy pattern
say again
Yes
I'm using the browser
I'll
if (i < 3 && j < 3)
cells[j].push(board[i][j % 3])


// I think they give an indication of which cell we are in
columns[j].push(board[i][j])
// I'm trying to get a way of identifying where each element belongs
nums.push(board[i][j])
}
}

// Except if we generate columns as we loop through the rows so that we just use the same funtion to see if there is any repetition

// CASE 3: group every 3 x 3 block and check if there is repetition
// Maybe we'll use an Object or array to generate a flat array as we loop through every 3 x i columns and row

};
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.