Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python Code You have an infinite number of 4 types of lego blocks of sizes given as ( depth x height x width ) :
Python Code
You have an infinite number of types of lego blocks of sizes given as depth x height x width:
d h w
Using these blocks, you want to make a wall of height n and width m Features of the wall are:
The wall should not have any holes in it
The wall you build should be one solid structure, so there should not be a straight vertical break across all rows of bricks.
The bricks must be laid horizontally.
How many ways can the wall be built?
Example
n
m
The height is and the width is Here are some configurations:
These are not all of the valid permutations. There are valid permutations in all.
Function Description
Complete the legoBlocks function in the editor below.
legoBlocks has the following parameters:
int n: the height of the wall
int m: the width of the wall
Returns
int: the number of valid wall formations modulo
Input Format
The first line contains the number of test cases t
Each of the next t lines contains two spaceseparated integers n and m
Constraints
t
n m
Sample Input
STDIN Function
t
n m
n m
n m
n m
Sample Output
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started