Question: SparkNest Systems Coding round | Recent Online Assessment 2025 | 2D Array Generation & Anagram Logic | SparkNest Coding Round | Incremental Matrix Building & String Sorting
0
Entering edit mode

Question 1: Generate 2D Array

Problem Statement: Write a program that takes 4 inputs, where each input consists of 2 numbers in the format x,y. You are required to print a two-dimensional array having x rows and y columns for each input. The elements of the arrays should be whole numbers starting from 1 and incrementing by 1.

input-:

2,2
2,3
3,3
3,4

Sample Output:

[[1, 2], [3, 4]]
[[1, 2, 3], [4, 5, 6]]
[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
[[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]

 

Question 2: Anagram Check

Problem Statement: Determine if two given words are anagrams of each other. An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.

Input Format:

  • The first line contains the first word.

  • The second line contains the second word.

Output Format:

  • Print 1 if the two words are anagrams.

  • Print 0 if the two words are not anagrams.

Input-: 

Creative
Reactive

Ouput-: 

1

 

Login before adding your answer.

Similar Posts
Loading Similar Posts