What do you want to save?
Add Code snippet
New code examples
-
Python 2021-11-15 20:13:20
form a chakravyuh matrix python
num=int(input("enter the length of square matrix")) n_list=[[0 for x in range(num)] for y in range(num)] n=1 low=0 high=num - 1 count=int((num+1)/2) for i in range(count): for j in range(low,high+1): n_list[i][j]=n n+=1 ... Add solution -
Javascript 2021-10-08 17:21:03
Javascript multiply a square matrix
// Multiply a square matrix const squareMatrix = (a, b) => a.map(x => x.map((_, i) => x.reduce((s, e, j) => s + e * b[j][i], 0))); console.log(squareMatrix([[1, 2], [3, 2]], [[3, 2], [1, 1]]) ); // Answer: [[5, 4], [11, 8]] console.log(sq... Add solution -
Python 2021-10-03 09:38:08
rotate matrix 90 degrees clockwise in python
#The program defines the square matrix 90 degrees clockwise direction. m,n = map(int,input().split()) #m,n are the number of rows and columns. #m = int(input('rows')) l = [] for i in range(m): x = list(map(int,input().split())) #for taking the rows a ... Add solution
Best helpers
Ranking is empty