Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Javascript_Algo/MatrixTranspose.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
let mathData = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
];
function transMat(matrix) {
let newMatx = [];
for (let i = 0; i < matrix[0].length; i++) {
let newMat = [];
for (let j = 0; j < matrix[0].length; j++) {
newMat.push(matrix[j][i]);
}
newMatx.push(newMat);
}
// console.log(newMat)
return newMatx;
}
console.table(transMat(mathData));
18 changes: 18 additions & 0 deletions Javascript_Algo/palindrome.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
function palindrome(str, word) {
let jum = 0;
function count(word) {
while (word.length >= str.length) {
if (word.substring(0, str.length) == str) {
jum++;
}
word = word.substring(1);
}
}
count(word);
count(reverseString(word));
return jum;
}
function reverseString(str) {
return str;
}
console.log(palindrome("nana", "banananana"));