4 kyu

Validate Sudoku with size `NxN`

2,770 of 9,828cbmono

Description:

Given a Sudoku data structure with size NxN, N > 0 and √N == integer, write a method to validate if it has been filled out correctly.

The data structure is a multi-dimensional Array, i.e:

[
  [7,8,4,  1,5,9,  3,2,6],
  [5,3,9,  6,7,2,  8,4,1],
  [6,1,2,  4,3,8,  7,5,9],
  
  [9,2,8,  7,1,5,  4,6,3],
  [3,5,7,  8,4,6,  1,9,2],
  [4,6,1,  9,2,3,  5,8,7],
  
  [8,7,6,  3,9,4,  2,1,5],
  [2,4,3,  5,6,1,  9,7,8],
  [1,9,5,  2,8,7,  6,3,4]
]

Rules for validation

  • Data structure dimension: NxN where N > 0 and √N == integer
  • Rows may only contain integers: 1..N (N included)
  • Columns may only contain integers: 1..N (N included)
  • 'Little squares' (3x3 in example above) may also only contain integers: 1..N (N included)
Arrays
Puzzles
Algorithms
Object-oriented Programming

Stats:

CreatedSep 6, 2014
PublishedSep 6, 2014
Warriors Trained34093
Total Skips11245
Total Code Submissions156728
Total Times Completed9828
JavaScript Completions2770
CoffeeScript Completions44
Python Completions4768
Ruby Completions511
Rust Completions840
C# Completions1028
Total Stars936
% of votes with a positive feedback rating84% of 1268
Total "Very Satisfied" Votes946
Total "Somewhat Satisfied" Votes247
Total "Not Satisfied" Votes75
Ad
Contributors
  • cbmono Avatar
  • jhoffner Avatar
  • salztorte Avatar
  • GiacomoSorbi Avatar
  • evman182 Avatar
  • imjasonmiller Avatar
  • Voile Avatar
  • Souzooka Avatar
  • FArekkusu Avatar
  • hobovsky Avatar
  • user8436785 Avatar
  • Just4FunCoder Avatar
Ad