Close
Topic list
Naughty Luke
EASY
15 mins
Matrices (2D Arrays)
Topics (Covered in this problem)
Problem solved
Skill meter
Matrices (2D Arrays)
-
-
Other topics
Problem solved
Skill meter
Strings
-
-
-
-
Sorting
-
-
Binary Search
-
-
Stacks & Queues
-
-
Trees
-
-
Graph
-
-
Dynamic Programming
-
-
Greedy
-
-
Tries
-
-
Arrays
-
-
SQL
-
-
Binary Search Trees
-
-
Heap
-
-
Bit Manipulation
-
-
Solve problems & track your progress
Checkout your overall progress in every topic here
Become
Sensei
in DSA topics
Open the topic and solve more problems associated with it to improve your skills
Check out the skill meter for every topic
See how many problems you are left with to solve for cracking any stage. Score more than zero to get your progress counted.

Naughty Luke

Contributed by
Kamal Pathak
Easy
0/40
Avg time to solve 15 mins
Success Rate 70 %
Share

Problem Statement

The black colour is represented by '1' and white colour is represented by '0' here. You have to print the final grid.

Example :
``````'N' = 2, 'A' = { {0, 1}, {0, 0} }.

After twisting, the grid looks like :
'A' =  { {1, 0}, {0, 0} }.

After changing the colours, the grid looks like :
'A' =  { {0, 1}, {1, 1} }.
``````
Detailed explanation ( Input/output format, Notes, Constraints, Images )
Sample Input 1 :
``````2
3
1 1 0
0 1 1
1 0 0
1
0
``````
Sample Output 1 :
``````1 0 0
0 0 1
1 1 0
1
``````
Explanation Of Sample Input 1 :
``````For test 1:
After twisting the grid looks like : { {0, 1, 1}, {1, 1, 0}, {0, 0, 1} }.
After changing the colour of cells the grid looks like : { {1, 0, 0}, {0, 0, 1}, {1, 1, 0} }.

For test 2:
After twisting the grid looks like : { {0} }.
After changing the colour of cells the grid looks like : { {1} }.
``````
Sample Input 2 :
``````2
3
1 1 1
1 1 1
1 1 1
4
1 1 1 1
0 0 0 0
1 1 1 1
0 0 0 0
``````
Sample Output 2 :
``````0 0 0
0 0 0
0 0 0
0 0 0 0
1 1 1 1
0 0 0 0
1 1 1 1
``````
Auto
Console