We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Brick Tiling
Brick Tiling
Sort by
recency
|
13 Discussions
|
Please Login in order to post a comment
from collections import defaultdict import os
MAX_ROWS = 20 MAX_COLS = 8
def set_bit(num, count): return num | (1 << count)
def get_bit(num, i): return (num & (1 << i)) != 0
def clear_bit(num, i): mask = ~(1 << i) return num & mask
class Tile2: def init(self, row1, col1, row2, col2, row3, col3, row4, col4): self.rows = [row1, row2, row3, row4] self.cols = [col1, col2, col3, col4]
TILES = [ Tile2(0, 0, 1, 0, 2, 0, 2, 1), Tile2(0, 0, 1, 0, 1, -1, 1, -2), Tile2(0, 0, 0, 1, 1, 1, 2, 1), Tile2(0, 0, 1, 0, 0, 1, 0, 2), Tile2(0, 0, 1, 0, 2, 0, 2, -1), Tile2(0, 0, 0, 1, 0, 2, 1, 2), Tile2(0, 0, 0, 1, 1, 0, 2, 0), Tile2(0, 0, 1, 0, 1, 1, 1, 2) ]
def get_hash(arr): return ''.join(format(num, '02x') for num in arr)
cache = defaultdict(int)
def get_my_count(arr, empty_count): if empty_count % 4 != 0: return 0
def brickTiling(grid): arr = [0] * MAX_ROWS empty_count = 0 N = len(grid) M = len(grid[0])
if name == 'main': fptr = open(os.environ['OUTPUT_PATH'], 'w')
Here is my solution in java, javascript,python, C,C++, Chsarp HackerRank Brick Tiling Problem Solution
Here is the solution of Brick Tiling Click here
Here is Brick Tiling problem solution - https://programs.programmingoneonone.com/2021/07/hackerrank-brick-tiling-problem-solution.html
C++ Solution