5 kyu

Chess Fun #9: Bishops And Rooks

215 of 405myjinxin2015

Description:

Task

You are given a chessboard with several rooks and bishops placed on some of its squares. How many unoccupied squares are there that are not under attack of any chess piece?

Here, the standard rules are applied: a square is under attack of a rook or a bishop only if all squares between the piece and the current square are unoccupied.

Input/Output

  • [input] integer array chessboard

matrix of size 8x8 containing numbers {-1, 0, 1} which represents chess pieces placement:

-1 -> bishop, 0 -> empty square, 1 -> rook

  • [output] an integer

number of safe squares on the board.

Puzzles

Stats:

CreatedFeb 15, 2017
PublishedFeb 15, 2017
Warriors Trained1366
Total Skips92
Total Code Submissions1706
Total Times Completed405
JavaScript Completions112
C# Completions64
Python Completions215
C Completions31
D Completions4
Rust Completions15
COBOL Completions3
Lua Completions8
Total Stars41
% of votes with a positive feedback rating96% of 108
Total "Very Satisfied" Votes100
Total "Somewhat Satisfied" Votes7
Total "Not Satisfied" Votes1
Total Rank Assessments5
Average Assessed Rank
5 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
6 kyu
Ad
Contributors
  • myjinxin2015 Avatar
  • Blind4Basics Avatar
  • hobovsky Avatar
  • trashy_incel Avatar
  • akar-0 Avatar
  • 4500zenja1 Avatar
  • PetitLu117 Avatar
Ad