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

Programming Exercises

Write a function to calculate the determinant of a matrix recursively.

Hard

Problem Statement

Write a function to calculate the determinant of a matrix recursively.

Sample Input

Matrix: 
 [,1] [,2] [,3]
[1,] 1 2 3
[2,] 4 5 6
[3,] 7 8 9

Sample Output

Determinant: 0

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
# Predefined structure recursive_determinant <- function(matrix) { # Your logic here } # Call the function
Log in or sign up to run or submit your code.Log inSign up
Input
Matrix: 
 [,1] [,2] [,3]
[1,] 1 2 3
[2,] 4 5 6
[3,] 7 8 9
Expected Output
Determinant: 0