MeetCode
2x2 Determinant
C
C++
Computer Mathematics
CSS
DSA
HTML
Java
JavaScript
NodeJS
PHP
Programming Interview
Python
ReactJS
SQL
Run
Submit
Dark
Problem Statement
Solutions
Submissions
2x2 Determinant
Easy
Computer Mathematics
Matrices
31 views
Explanation
Complexity
Problem Statement
Compute determinant of 2x2 matrix.
Input Format
Four integers a b c d (matrix [[a,b],[c,d]]).
Output Format
One integer det.
Example
Input
1 2 3 4
Output
-2
Constraints
Values fit 64-bit
Input / Output Format
Input Format
Four integers a b c d (matrix [[a,b],[c,d]]).
Output Format
One integer det.
Constraints
Values fit 64-bit
Examples
Input:
1 2 3 4
Output:
-2
Example Solution (Public)
Computer Mathematics
det = a*d - b*c.
Official Solution Code
Wrap
Copy
det = a*d - b*c.
Please
login
to submit solutions.
Editor
C
C++
Computer Mathematics
CSS
DSA
HTML
Java
JavaScript
NodeJS
PHP
Programming Interview
Python
ReactJS
SQL
Test Cases
Output
Submission Result
Input
1 2 3 4
Expected Output
-2
Compile Output
Error
Output
Please
login
to submit solutions.