Company: urban_29july
Difficulty: medium
Bitwise Palindromic Paths Problem Description You are given a binary matrix of size N x M where each cell contains either 0 or 1. A path from the top-left cell (0,0) to the bottom-right cell (N-1,M-1) is valid if you can only move right or down at each step. A path is called bitwise palindromic if the sequence of bits collected along the path forms a palindrome when interpreted as a string (e.g., 010, 1, 101). Your task is to count the number of such bitwise palindromic paths. Function Description: You need to implement the function countBitwisePalindromicPaths . Parameters: N: An integer representing the number of rows. M: An integer representing the number of columns. grid: A 2D list of size N x M consisting of binary values (0 or 1). Return: An integer representing the number of valid bitwise palindromic paths from (0,0) to (N-1,M-1), modulo 10 9 + 7. Input Format The first line contains a single integer N. The second line contains a single integer M. The next N lines each contain M