← 返回 bytedance 的题目列表Unique Path Grid with Bit Manipulation
类型:online_judge
Given an m x n grid, write a function to calculate the number of unique paths from the top-left corner to the bottom-right corner. You can move either down or right at any point in time. The solution must have an O(1) space complexity, and you're only allowed to use in-place modifications.
Input Format:
The first line contains two integers m and n, indicating the size of the grid.
Requirement:
Use bit manipulation creatively to calculate paths in-place.
Test Cases:
Input:
3 7
Output:
28
Example
Input
3 7