Question: Write a function that returns a chessboard pattern (B for black squares, W for white squares). The function takes a number N as input
Write a function that returns a chessboard pattern ("B" for black squares, "W" for white squares). The function takes a number N as input and generates the corresponding board. Input The first line of the input consists of an integer - num, representing the size of the chessboard(N). Output Print N lines consist of N space- separated characters representing the chessboard pattern. Constraints 0 < N Example Input: 5 Output: WBWBW BWBWB WBWBW BWBWB WBWBW Explanation: The size of the chessboard is 5 and the top left square will always be white. So, the output pattern is: [[WBWBW], [BW BW B], [WBWBW], [BW BW B], [WBWBW]]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
