Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Perform operations on a sparse matrix representation.

Hard

Problem Statement

Perform operations on a sparse matrix representation.

Sample Input

Matrix: [[0, 0, 3], [0, 5, 0], [6, 0, 0]]

Sample Output

Original Matrix:
0 0 3 
0 5 0 
6 0 0 
Sparse Matrix: (0, 2, 3), (1, 1, 5), (2, 0, 6)
Reconstructed Matrix:
0 0 3 
0 5 0 
6 0 0 

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
using System; using System.Collections.Generic; class SparseMatrix { static void Main() { // Perform operations on a sparse matrix } }
Log in or sign up to run or submit your code.Log inSign up
Input
Matrix: [[0, 0, 3], [0, 5, 0], [6, 0, 0]]
Expected Output
Original Matrix:
0 0 3 
0 5 0 
6 0 0 
Sparse Matrix: (0, 2, 3), (1, 1, 5), (2, 0, 6)
Reconstructed Matrix:
0 0 3 
0 5 0 
6 0 0