You are given an N × N matrix in which every cell is colored black or white. Columns are numbered from 0 to N-1 (from left to right). This coloring is represented by a non-empty array of integers A. If the K-th number in the array is equal to X then the X lowest cells in the K-th column of the matrix are black. The rest of the cells in the K-th column are white. The task is to calculate the side length of the biggest black square (a square containing only black cells).
Write a function:
def solution(A)
that, given an array of integers A of length N representing the coloring of the matrix, returns the side length of the biggest black square.
Examples:
1. Given A = [1, 2, 5, 3, 1, 3], the function should return 2. For example, the black square of side 2 contains the two lowest rows of the 1st and 2nd columns (counting from 0).
2. Given A = [3, 3, 3, 5, 4], the function should return 3. For example, the biggest black square has side 3 and contains the three lowest rows of the last three columns.
3. Given A = [6, 5, 5, 6, 2, 2], the function should return 4. The biggest black square has side 4 and contains the four lowest rows of the first four columns.
Write an efficient algorithm for the following assumptions:
- N is an integer within the range [1..100,000];
- each element of array A is an integer within the range [1..N].
Invalid result type, int expected, <class 'NoneType'> found.
Invalid result type, int expected, <class 'NoneType'> found.
Invalid result type, int expected, <class 'NoneType'> found.
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_rows = len(A)
for i in range(matrix_no_rows:
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns:
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if mat
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i <
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(A[i])
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
if min()
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
if min(cur_m)
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
if min(cur_matrix + [])
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
if min(cur_matrix + [len()])
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
if min(cur_matrix + [len(cur_matrix)]) > cur_
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
if min(cur_matrix + [len(cur_matrix)]) > current_max:
continue
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
if min(cur_matrix + [len(cur_matrix)]) > current_max:
continue
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
if min(cur_matrix + [len(cur_matrix)]) > current_max:
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
if min(cur_matrix + [len(cur_matrix)]) > current_max:
current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
current_square =
if min(cur_matrix + [len(cur_matrix)]) > current_max:
current_max =
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if current_square > current_max:
current_max =
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if current_square > current_max:
current_max = current_square
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) >
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
print(current_square)
if len(cur_matrix) > min(cur_matrix):
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1 1
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
print(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
print(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
[1, 1] [2, 1] [5, 1] [3, 1] [3, 1]
[3, 1] [3, 1] [3, 1] [5, 1] [4, 1]
[6, 1] [5, 1] [5, 1] [6, 1] [2, 1] [2, 1]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
print(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix) :
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
print(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix) + 1:
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
[1, 1] [2, 1] [5, 1] [3, 1] [3, 1]
[3, 1] [3, 1] [3, 1] [5, 1] [4, 1]
[6, 1] [5, 1] [5, 1] [6, 1] [2, 1] [2, 1]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
print(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix) + :
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
print(cur_matrix + [len(cur_matrix)])
# if len(cur_matrix) > min(cur_matrix):
# continue
if current_square > current_max:
current_max = current_square
return current_max
pass
[1, 1] [2, 1] [5, 1] [3, 1] [3, 1]
[3, 1] [3, 1] [3, 1] [5, 1] [4, 1]
[6, 1] [5, 1] [5, 1] [6, 1] [2, 1] [2, 1]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
# if matrix_no_columns - i < current_max:
# break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
print(cur_matrix + [len(cur_matrix)])
# if len(cur_matrix) > min(cur_matrix):
# continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
# if matrix_no_columns - i < current_max:
# break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
print(cur_matrix + [len(cur_matrix)])
# if len(cur_matrix) > min(cur_matrix):
# continue
if current_square > current_max:
current_max = current_square
return current_max
pass
[1, 1] [2, 1] [5, 1] [3, 1] [3, 1]
[3, 1] [3, 1] [3, 1] [5, 1] [4, 1]
[6, 1] [5, 1] [5, 1] [6, 1] [2, 1] [2, 1]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
cur_matrix = []
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
print(cur_matrix + [len(cur_matrix)])
# if len(cur_matrix) > min(cur_matrix):
# continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
for i in range(matrix_no_columns):
x cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
print(cur_matrix + [len(cur_matrix)])
# if len(cur_matrix) > min(cur_matrix):
# continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix + [len(cur_matrix)]
for i in range(matrix_no_columns):
x cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
print(cur_matrix + [len(cur_matrix)])
# if len(cur_matrix) > min(cur_matrix):
# continue
if current_square > current_max:
current_max = current_square
return current_max
pass
Traceback (most recent call last): File "exec.py", line 129, in <module> main() File "exec.py", line 70, in main sol = __import__('solution') File "/tmp/solution.py", line 10 x cur_column = A[i] ^ IndentationError: expected an indented block
Traceback (most recent call last): File "exec.py", line 129, in <module> main() File "exec.py", line 70, in main sol = __import__('solution') File "/tmp/solution.py", line 10 x cur_column = A[i] ^ IndentationError: expected an indented block
Traceback (most recent call last): File "exec.py", line 129, in <module> main() File "exec.py", line 70, in main sol = __import__('solution') File "/tmp/solution.py", line 10 x cur_column = A[i] ^ IndentationError: expected an indented block
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A
for i in range(matrix_no_columns):
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
print(cur_matrix + [len(cur_matrix)])
# if len(cur_matrix) > min(cur_matrix):
# continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
print(cur_matrix + [len(cur_matrix)])
# if len(cur_matrix) > min(cur_matrix):
# continue
if current_square > current_max:
current_max = current_square
return current_max
pass
[1, 1] [1, 2, 2] [1, 2, 5, 3] [1, 2, 5, 3, 4] [1, 2, 5, 3, 3, 5]
[3, 1] [3, 3, 2] [3, 3, 3, 3]
[6, 1] [6, 5, 2] [6, 5, 5, 3] [6, 5, 5, 6, 4]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
cur_column = A[i]
if cur_column <= current_max:
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
print(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
cur_column = A[i]
if cur_column <= current_max:
cur_matrix = []
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
print(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
[1, 1] [1, 2, 2] [5, 1] [5, 3, 2]
[3, 1] [3, 3, 2] [3, 3, 3, 3]
[6, 1] [6, 5, 2] [6, 5, 5, 3] [6, 5, 5, 6, 4]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
cur_column = A[i]
if cur_column <= current_max:
cur_matrix = []
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
cur_column = A[i]
if cur_column <= current_max:
cur_matrix = []
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
cur_column = A[i]
if cur_column <= current_max:
cur_matrix = []
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
cur_column = A[i]
if cur_column <= current_max:
cur_matrix = []
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
[1, 2, 3, 4, 5, 6, 7, 8, 9]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
cur_column = A[i]
if cur_column <= current_max:
cur_matrix = []
continue
# if matrix_no_columns - i < current_max:
# break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
cur_column = A[i]
if cur_column <= current_max:
cur_matrix = []
continue
# if matrix_no_columns - i < current_max:
# break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
[1, 2, 3, 4, 5, 6, 7, 8, 9]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
cur_column = A[i]
if cur_column <= current_max:
cur_matrix = []
continue
# if matrix_no_columns - i < current_max:
# break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
for j in range()
cur_column = A[i]
if cur_column <= current_max:
cur_matrix = []
continue
# if matrix_no_columns - i < current_max:
# break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
for j in range(i, matrix_no_columns)
cur_column = A[i]
if cur_column <= current_max:
cur_matrix = []
continue
# if matrix_no_columns - i < current_max:
# break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
for j in range(i, matrix_no_columns):
cur_column = A[i]
if cur_column <= current_max:
cur_matrix = []
continue
# if matrix_no_columns - i < current_max:
# break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
for j in range(i, matrix_no_columns):
cur_column = A[i]
if cur_column <= current_max:
cur_matrix = []
continue
# if matrix_no_columns - i < current_max:
# break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
cur_matrix = []
continue
# if matrix_no_columns - i < current_max:
# break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
cur_matrix = [A]
for j in range(i+1, matrix_no_columns):
cur_column = A[i]
if cur_column <= current_max:
cur_matrix = []
continue
# if matrix_no_columns - i < current_max:
# break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[i]
if cur_column <= current_max:
cur_matrix = []
continue
# if matrix_no_columns - i < current_max:
# break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
cur_matrix = []
continue
# if matrix_no_columns - i < current_max:
# break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
cur_matrix = []
continue
# if matrix_no_columns - i < current_max:
# break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
[1, 2, 3, 4, 5, 6, 7, 8, 9]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
cur_matrix = []
continue
if matrix_no_columns - i < current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
[1, 2, 3, 4, 5, 6, 7, 8, 9]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
cur_matrix = []
continue
x
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
cur_matrix = []
continue
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
cur_matrix = []
continue
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
[1, 2, 3, 4, 5, 6, 7, 8, 9]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
cur_matrix = []
continue
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
[1, 2, 3, 4, 5, 6, 7, 8, 9, 8]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
cur_matrix = []
continue
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
[1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 8]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
cur_matrix = []
continue
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
cur_matrix = []
continue
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
[1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 8, 1]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
cur_matrix = []
continue
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
[1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 8, 1, 9]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
cur_matrix = []
continue
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
[1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 8, 1, 9, 9, 9, 9, 9, 9, 9]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
cur_matrix = []
continue
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
cur_matrix = []
continue
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max :
break
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
cur_matrix = []
continue
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max + 1:
break
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
cur_matrix = []
continue
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max + 1:
break
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
cur_matrix = []
continue
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
[0, 1]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max + 1:
break
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
cur_matrix = []
continue
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
[1, 0, 1]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max + 1:
break
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
cur_matrix = []
continue
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
[1, 0]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max + 1:
break
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
continue
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max + 1:
break
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
continue
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
[1, 0]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max + 1:
break
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
cur_matrix = []
continue
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
[1, 0]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max + 1:
break
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
continue
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max + 1:
break
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
[1, 0]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i + 1< current_max:
break
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
[1, 0]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
[1, 0]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
[1, 1, 0]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
[1, 10]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
if A[1] > 0:
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
if A[1] > 0 and current_max == 0:
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
if A[1] > 0 and current_max == 0:
current_max
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
if A[1] > 0 and current_max == 0:
current_max = 1
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
[1, 10]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
if A[1] > 0 and current_max == 0:
current_max = 1
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
[2, 10]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
if A[1] > 0 and current_max == 0:
current_max = 1
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
[5, 10]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
if A[1] > 0 and current_max == 0:
current_max = 1
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
if A[1] > 0 and current_max == 0:
current_max = 1
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
Traceback (most recent call last): File "exec.py", line 129, in <module> main() File "exec.py", line 91, in main result = solution( A ) File "/tmp/solution.py", line 14, in solution if A[1] > 0 and current_max == 0: IndexError: list index out of range
[10]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
if Ai1] > 0 and current_max == 0:
current_max = 1
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
if A[i] > 0 and current_max == 0:
current_max = 1
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
if A[i] > 0 and current_max == 0:
current_max = 1
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
if A[i] > 0 and current_max == 0:
current_max = 1
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
if A[i] > 0 and current_max == 0:
current_max = 1
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
[0, 1]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
if A[i] > 0 and current_max == 0:
current_max = 1
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
if A[i] > 0 and current_max == 0:
current_max = 1
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
[0, 2, 2]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
if A[i] > 0 and current_max == 0:
current_max = 1
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
[0, 3, 3, 3]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
if A[i] > 0 and current_max == 0:
current_max = 1
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
[3, 3, 3, 0]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
if A[i] > 0 and current_max == 0:
current_max = 1
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
[3, 3, 4, 0]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
if A[i] > 0 and current_max == 0:
current_max = 1
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
if A[i] > 0 and current_max == 0:
current_max = 1
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
[3, 3, 4, 0, 2, 2]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
if A[i] > 0 and current_max == 0:
current_max = 1
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
[3, 3, 4, 0, 2, 2, 2, 2, 2]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
if A[i] > 0 and current_max == 0:
current_max = 1
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
# cur_matrix = []
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
# cur_matrix = []
break
if current_square > current_max:
current_max = current_square
return current_max
pass
[3, 3, 4, 0, 5, 5, 5, 5, 5]
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
if A[i] > 0 and current_max == 0:
current_max = 1
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
break
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
if A[i] > 0 and current_max == 0:
current_max = 1
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
break
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
if A[i] > 0 and current_max == 0:
current_max = 1
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
break
if current_square > current_max:
current_max = current_square
return current_max
pass
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
current_max = 0
matrix_no_columns = len(A)
cur_matrix = []
for i in range(matrix_no_columns):
if matrix_no_columns - i < current_max:
break
cur_matrix = [A[i]]
if A[i] > 0 and current_max == 0:
current_max = 1
for j in range(i+1, matrix_no_columns):
cur_column = A[j]
if cur_column <= current_max:
break
cur_matrix.append(cur_column)
current_square = min(cur_matrix + [len(cur_matrix)])
if len(cur_matrix) > min(cur_matrix):
break
if current_square > current_max:
current_max = current_square
return current_max
pass
The following issues have been detected: timeout errors.
Tests with the biggest square surrounded by shorter columns. N <= 10.
Tests with alternating small and big numbers (relatively). N <= 15.
Two monotonic sequences or one monotonic and one constant. N <= 75.
Tests with local maximums and local minimums. N <= 75.
Various combinations of monotonic and constant sequences. N <= 750.
running time: 0.176 sec., time limit: 0.144 sec.
Randomly generated tests. N <= 10,000. Score x 2.
running time: 1.252 sec., time limit: 0.256 sec.