<jupyter_start><jupyter_text>Count the maximum square with all side 1<jupyter_code>mat = [
        [1, 1, 1, 1, 1, 1],
        [1, 0, 1, 1, 0, 1],
        [0, 1, 1, 0, 0, 1],
        [1, 1, 1, 1, 1, 1],
        [1, 0, 0, 1, 0, 1],
        [1, 0, 1, 1, 0, 0],
        [1, 0, 1, 0, 1, 1],
        [1, 1, 1, 0, 1, 1]
    ]

mat = np.asarray(mat)
del1 = np.zeros((9,7))
del2 = np.zeros((9,7))

for i in range(8):
    for j in range(6):
        del1[i+1][j+1] = mat[i][j]


max = 0
for i in range(8):
    for j in range(6):
        if del1[i+1][j+1] == 0:
            del2[i+1][j+1] = 0
        else:
            del2[i+1][j+1]= min(del1[i][j+1], del1[i][j], del1[i+1][j]) + 1

            
#only 2 all 1,1 sqaures are there.
del2<jupyter_output><empty_output><jupyter_text>Count max square with boundary 1<jupyter_code>mat_X= np.zeros((8,6))
mat_Y = np.zeros((8,6))
mat_Z = np.zeros((8,6))

# For x coordinate
for i in range(8):
    for j in range(6):
        if mat[i][j] != 0:
            if i > 0:
                if mat[i-1][j] == 1:
                    mat_X[i][j] = mat_X[i-1][j] + 1
                else:
                    mat_X[i][j] = 1
            else:
                mat_X[i][j] = 1
        else:
            mat_X[i][j] = 0

#For y coordinate
for i in range(8):
    for j in range(6):
        if mat[i][j] != 0:
            if j > 0:
                if mat[i][j-1] == 1:
                    mat_Y[i][j] = mat_Y[i][j-1] + 1
                else:
                    mat_Y[i][j] = 1
            else:
                mat_Y[i][j] = 1
        else:
            mat_Y[i][j] = 0
            
mat_Z = mat_X
mat_X = mat_Y
mat_Y = mat_Z
#Counting the max dimension of the squre
max_len = 0
for i in reversed(range(8)):
    for j in reversed(range(6)):
        x = mat_X[i][j]
        y = mat_Y[i][j]
        length = int(min(mat_X[i][j], mat_Y[i][j]))
        while length:
            isSquare  = mat_Y[i][j - length + 1] >= length and mat_X[i - length + 1][j] >= length
                
            if isSquare and max_len < length:
                    max_len = length
            length = length - 1
max_len<jupyter_output><empty_output><jupyter_text>Containers transported by Ship<jupyter_code>#weights = [1,2,3,4,5,6,7,8,9,10]
#days =  5
weights = [3,2,2,4,1,4]
days = 2

weights = sorted(weights)
min_weights = weights[-1]
max_weights = sum(weights)


days_found = 0
while days_found != days:
    days_found = 0
    print("_____________________________")
    print("start")
    mid  = (min_weights + max_weights)//2
    print(mid)
    weights_cpy = weights
    sum_package = 0
    for i in weights_cpy:
        if sum_package <= mid:
            if (mid - sum_package >= i):
                sum_package = i + sum_package
                print(sum_package)
            else:
                print("-- Finally--")
                days_found = days_found + 1
                sum_package = 0
                sum_package = i + sum_package
    days_found = days_found+1
    
    if days_found < days:
        max_weights = mid
        mid = (min_weights + max_weights)//2
        
    if days_found > days:
        min_weights = mid
        mid = (min_weights + max_weights)//2
    print("------------")
    print(days_found)
    print("end")
        
print("Hello")
print(mid)
    def shipWithinDays(weights, D):
        left, right = max(weights), sum(weights)
        while left < right:
            mid, need, cur = (left + right) // 2, 1, 0
            for w in weights:
                if cur + w > mid:
                    need += 1
                    cur = 0
                cur += w
            if need > D: left = mid + 1
            else: right = mid
        return left<jupyter_output><empty_output><jupyter_text>Binary Tree<jupyter_code>class newNode:
 
    # Construct to create a new node
    def __init__(self, key):
        self.data = key
        self.left = None
        self.right = None
        
if __name__ == '__main__':
     
    """
    Let us create Binary Tree shown
    in above example """
    root = newNode(5)
    root.left = newNode(2)
    root.right = newNode(6)
    root.left.left = newNode(1)
    root.left.right = newNode(4)
    root.left.right.left = newNode(3)
    root.right.right = newNode(8)
    root.right.right.right = newNode(9)
    root.right.right.left = newNode(7)
q=[]
q.append(root)
print(len(q))
mat.T<jupyter_output><empty_output><jupyter_text>Spiral Matrix<jupyter_code>def printdata(arr, i, j, m, n):

    # If i or j lies outside the matrix
    if (i >= m or j >= n):
        return

    # Print First Row
    for p in range(i, n):
        print(arr[i][p], end=" ")

    # Print Last Column
    for p in range(i + 1, m):
        print(arr[p][n - 1], end=" ")

    # Print Last Row, if Last and
    # First Row are not same
    if ((m - 1) != i):
        for p in range(n - 2, j - 1, -1):
            print(arr[m - 1][p], end=" ")

    # Print First Column, if Last and
    # First Column are not same
    if ((n - 1) != j):
        for p in range(m - 2, i, -1):
            print(arr[p][j], end=" ")

    printdata(arr, i + 1, j + 1, m - 1, n - 1)


# Driver code
R = 4
C = 4
arr = [[1, 2, 3, 4],
       [5, 6, 7, 8],
       [9, 10, 11, 12],
       [13, 14, 15, 16]]

# Function Call
printdata(arr, 0, 0, R, C)
l = range(2,5)
l[2]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14871216394059034, 'fraction_numerical': 0.038917089678511, 'mean_word_length': 1.7338129496402879, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '313088', 'license': 'MIT', 'n_tokens_mistral': 2121, 'n_tokens_neox': 1969, 'n_words': 539, 'path': 'Week1/ZS.ipynb', 'repo_name': 'Armos05/Ai-for-Medical-Diagnosis-Specialization', 'size': '5319'}