Given an integer array `arr`, return `true` if there are three consecutive odd numbers in the array. Otherwise, return `false`.

**Example 1:**

**Input:** arr = \[2,6,4,1\]
**Output:** false
**Explanation:** There are no three consecutive odds.

**Example 2:**

**Input:** arr = \[1,2,34,3,4,5,7,23,12\]
**Output:** true
**Explanation:** \[5,7,23\] are three consecutive odds.

**Constraints:**

*   `1 <= arr.length <= 1000`
*   `1 <= arr[i] <= 1000`


import heapq


def kthSmallest(mat, k):
    m, n = len(mat), len(mat[0])

    minHeap = [(mat[0][0], 0, 0)]
    visited = [[False for _ in range(n)] for _ in range(m)]
    visited[0][0] = True

    for _ in range(k):
        res, i, j = heapq.heappop(minHeap)

        if i < m - 1 and not visited[i+1][j]:
            heapq.heappush(minHeap, (res - mat[i][j] + mat[i + 1][j], i + 1, j))
            visited[i+1][j] = True
        if j < n - 1 and not visited[i][j+1]:
            heapq.heappush(minHeap, (res - mat[i][j] + mat[i][j + 1], i, j + 1))
            visited[i][j+1] = True

    return res
