Beta

Odd Square Patch

Description:

Task

Create a function that takes an array of numbers, and returns the size of the biggest square patch of odd numbers. See examples for a clearer picture.

Examples

odd_square_patch([
  [1, 2, 4, 9],
  [4, 5, 5, 7],
  [3, 6, 1, 7]
])  2

# The 2x2 square at the lower right
# ([5, 7] on the 2nd row, [1, 7] on the third).

odd_square_patch([[1, 2, 4, 9]])  1

# An array with a single row can only have a square patch of
# maximum size 1x1 containing a single odd element.

odd_square_patch([[2, 4, 6]])  0

Input Constraints

  • Easy -> 0 <= rows, cols < 20
  • Medium -> 20 <= rows, cols < 100
  • Hard -> 100 <= rows, cols <= 200
Performance

More By Author:

Check out these other kata created by saudiGuy

Stats:

CreatedAug 19, 2023
PublishedAug 19, 2023
Warriors Trained27
Total Skips0
Total Code Submissions130
Total Times Completed24
Python Completions24
Total Stars2
% of votes with a positive feedback rating83% of 12
Total "Very Satisfied" Votes9
Total "Somewhat Satisfied" Votes2
Total "Not Satisfied" Votes1
Total Rank Assessments12
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
6 kyu
Ad
Contributors
  • saudiGuy Avatar
Ad