Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
9e28713
Update index.ts
MarkVRKS Sep 26, 2024
3502342
Create main.js
MarkVRKS Sep 27, 2024
529af4a
Create main.js
MarkVRKS Sep 27, 2024
0b973f1
Create main.js
MarkVRKS Sep 27, 2024
8cbe65f
Create main.js
MarkVRKS Sep 27, 2024
5927827
Create main.js
MarkVRKS Sep 27, 2024
193f1d2
Create main.js
MarkVRKS Sep 27, 2024
6678fad
Create main.js
MarkVRKS Sep 27, 2024
709767f
Create main.js
MarkVRKS Sep 27, 2024
c766379
Create main.py
MarkVRKS Sep 27, 2024
02365be
Create jest.test.js
MarkVRKS Sep 27, 2024
0e7a223
Update jest.test.js
MarkVRKS Oct 7, 2024
99c4c1a
Merge branch 'ISUCT:master' into master
MarkVRKS Oct 10, 2024
52203fa
Update index.ts
MarkVRKS Oct 10, 2024
5ba9d4b
Delete rpgsaga/saga/src/jest.test.js
MarkVRKS Oct 10, 2024
2af1e30
Create lab1.ts
MarkVRKS Oct 10, 2024
6f2f70a
Create lab2.ts
MarkVRKS Oct 10, 2024
9e80eae
Create cats.test.js
MarkVRKS Oct 10, 2024
d52f6fd
Create table.test.js
MarkVRKS Oct 10, 2024
854b1bc
Update lab2.ts
MarkVRKS Oct 17, 2024
1313b27
Update lab1.ts
MarkVRKS Oct 17, 2024
433a8d8
Update table.test.js
MarkVRKS Oct 17, 2024
ac9627b
Update cats.test.js
MarkVRKS Oct 17, 2024
aa9cb5d
Update lab1.ts
MarkVRKS Oct 17, 2024
c7df0f7
Update table.test.js
MarkVRKS Oct 17, 2024
18ef484
Update cats.test.js
MarkVRKS Oct 17, 2024
fbf7b6f
Update cats.test.js
MarkVRKS Oct 17, 2024
12ade07
codewars+lab1+lab2+tests
MarkVRKS Oct 24, 2024
65c01cf
Delete node_modules directory
MarkVRKS Oct 24, 2024
1d1a2b3
Delete package.json
MarkVRKS Oct 24, 2024
d06ef5c
Delete package-lock.json
MarkVRKS Oct 24, 2024
809b624
Delete eslint.config.mjs
MarkVRKS Oct 24, 2024
a7e7551
Delete rpgsaga/eslint.config.mjs
MarkVRKS Oct 24, 2024
5eafd16
lab1+lab2+cw
MarkVRKS Oct 26, 2024
8e36c16
add lab3+lab3.test
MarkVRKS Nov 3, 2024
d99842c
абстракт класс и полиморфизм + тесты к ним
MarkVRKS Nov 7, 2024
40ec4cf
rpgsaga ready
MarkVRKS Jan 3, 2025
4d8fa7c
rpgsaga
MarkVRKS Jan 3, 2025
a1022b5
Update rpg.test.ts
MarkVRKS Jan 7, 2025
eca3133
saga pls rabotai
MarkVRKS Jan 10, 2025
b2ac943
-ноды
MarkVRKS Jan 10, 2025
5476098
к экзки
MarkVRKS Jan 10, 2025
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
26 changes: 26 additions & 0 deletions codewars/Adding Big Numbers/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
function add(a, b) {
if (a.length === 0) {
return b;
}
if (b.length === 0) {
return a;
}
while (a.length < b.length) {
a = '0' + a;
}
while (b.length < a.length) {
b = '0' + b;
}
let carry = 0;
let res = '';
for (let i = a.length - 1; i >= 0; i--) {
const sum = parseInt(a[i]) + parseInt(b[i]) + carry;
res = (sum % 10) + res;
carry = Math.floor(sum / 10);
}
if (carry > 0) {
res = carry + res;
}

return res;
}
17 changes: 17 additions & 0 deletions codewars/Anagram difference/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
function anagramDifference(w1,w2){

let count={};

for (let i=0; i < w1.length; i++){
count[w1[i]] = (count[w1[i]] || 0) + 1;
}
for (let i=0; i < w2.length; i++){
count[w2[i]] = (count[w2[i]] || 0) - 1;
}
let res=0;
for (let x in count){
res += Math.abs(count[x])
}
return res
}

11 changes: 11 additions & 0 deletions codewars/Array Deep Count/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function deepCount(a) {

let alen = a.length;

for (const i of a) {
if (Array.isArray(i)) {
alen += deepCount(i);
}
};
return alen;
}
12 changes: 12 additions & 0 deletions codewars/Build Tower/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function towerBuilder(nFloors) {
let currentbl = [];
for (let i = 1; i <= nFloors; i++) {
if (i === 1) {
currentbl.push(' '.repeat(nFloors - i) + '*' + ' '.repeat(nFloors - i));
} else {
let counter = currentbl[currentbl.length - 1].split('').filter(char => char === '*').length + 2;
currentbl.push(' '.repeat(nFloors - i) + '*'.repeat(counter) + ' '.repeat(nFloors - i));
}
}
return currentbl;
}
6 changes: 6 additions & 0 deletions codewars/Convert string to camel case/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function toCamelCase(str){
const n = /[-_]\w/ig;;
return str.replace(n, (word) => {
return word[1].toUpperCase()
})
}
12 changes: 12 additions & 0 deletions codewars/Duplicate Encoder/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function duplicateEncode(word) {
word = word.toLowerCase();
let output = '';
for (let i = 0; i < word.length; i++) {
if (word.split(word[i]).length - 1 > 1) {
output += ')';
} else {
output += '(';
}
}
return output;
}
10 changes: 10 additions & 0 deletions codewars/Find the missing letter/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function findMissingLetter(array) {

const n = array[0].charCodeAt(0);
for(var i = 0; i < array.length; i++) {
if(array[i].charCodeAt(0) !== n + i) {
return String.fromCharCode(n + i);
}
}
return ' ';
}
13 changes: 13 additions & 0 deletions codewars/Flatten a Nested Map/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
function flattenMap(map) {
var res = {};
function recurse(current, sv) {
if (Object(current) !== current || Array.isArray(current)) {
return res[sv] = current;
}
for (var p in current) {
recurse(current[p], sv ? sv + "/" + p : p);
}
}
recurse(map, "");
return res;
}
11 changes: 11 additions & 0 deletions codewars/Fun with tree - max sum/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from preloaded import TreeNode

def max_sum(root: TreeNode) -> int:
if root is None:
return 0
elif root.left is None:
return root.value + max_sum(root.right)
elif root.right is None:
return root.value + max_sum(root.left)
else:
return root.value + max(max_sum(root.left), max_sum(root.right))
12 changes: 12 additions & 0 deletions codewars/Linked Lists - Sorted Insert/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class Node(object):
def __init__(self, data):
self.data = data
self.next = None

def sorted_insert(head, data):
if head is None or head.data > data:
output = Node(data)
output.next = head
return output
head.next = sorted_insert(head.next, data)
return head
21 changes: 21 additions & 0 deletions codewars/Merge two arrays/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
function mergeArrays(a, b) {

const finarray = [];

const blen = b.length;
const alen = a.length;

const maxlen = Math.max(alen, blen);

for (let i = 0; i < maxlen; i++) {
if (i < alen) {
finarray.push(a[i]);
}
if (i < blen) {
finarray.push(b[i]);

}

}
return finarray;
}
15 changes: 15 additions & 0 deletions codewars/Moving Zeros To The End/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
function moveZeros(arr) {

let bom = 0

for (let i = 0; i < arr.length; i++){
if (arr[i] !== 0){
arr[bom] = arr[i];
bom++;
}
}
for (let i = bom; i < arr.length; i++){
arr[i] = 0
}
return arr
}
17 changes: 17 additions & 0 deletions codewars/Permutations/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
function permutations(s) {
const permute = (arr) => {
if (arr.length === 0) return [[]];
const res = [];
for (let i = 0; i < arr.length; i++) {
const rest = arr.slice(0, i).concat(arr.slice(i + 1));
const subPerms = permute(rest);
for (const perm of subPerms) {
res.push([arr[i], ...perm]);
}
}
return res;
};
const uniquePerms = new Set(permute([...s]).map(p => p.join('')));
return [...uniquePerms];
}
console.log(permutations("abc"));
10 changes: 10 additions & 0 deletions codewars/Product of consecutive Fib numbers/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function productFib(prod) {
let first = 0;
let second = 1;
while (first * second < prod) {
const temp = second;
second = first + second;
first = temp;
}
return [first, second, first * second === prod];
}
11 changes: 11 additions & 0 deletions codewars/Simple Pig Latin/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function pigIt(str){
text = str.split(' ');

for (var i = 0; i < text.length; i++) {
if (/[a-zA-Z]/.test(text[i])){
text[i] = text[i].slice(1) + text[i][0] + 'ay';

}
}
return text.join(' ')
}
39 changes: 39 additions & 0 deletions codewars/Snail/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
def snail(snail_map):
top = 0
bot = len(snail_map) - 1
left = 0
right = len(snail_map[0]) - 1

res = []

while top <= bot and left <= right:
for i in range(left, right + 1):
res.append(snail_map[top][i])
top += 1

for i in range(top, bot + 1):
res.append(snail_map[i][right])
right -= 1

if top <= bot and left <= right:
for i in range(right, left - 1, -1):
res.append(snail_map[bot][i])
bot -= 1

for i in range(bot, top - 1, -1):
res.append(snail_map[i][left])
left += 1

return res

array1 = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
expected1 = [1, 2, 3, 6, 9, 8, 7, 4, 5]
assert snail(array1) == expected1

array2 = [[1, 2, 3],
[8, 9, 4],
[7, 6, 5]]
expected2 = [1, 2, 3, 4, 5, 6, 7, 8, 9]
assert snail(array2) == expected2
9 changes: 9 additions & 0 deletions codewars/Sum of Digits - Digital Root/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function digitalRoot(n) {

if(n === 0){
return 0
} else {
return 1 +((n-1) % 9);
}

}
17 changes: 17 additions & 0 deletions codewars/Sum of Intervals/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
function sumIntervals(intervals) {
intervals.sort((a, b) => a[0] - b[0]);
let letmerge = [];
let currentInterval = intervals[0];
for (let i = 1; i < intervals.length; i++) {
let next = intervals[i];
if (currentInterval[1] >= next[0]) {
currentInterval[1] = Math.max(currentInterval[1], next[1]);
} else {
letmerge.push(currentInterval);
currentInterval = next;
}
}
letmerge.push(currentInterval);
let output = letmerge.reduce((sum, interval) => sum + (interval[1] - interval[0]), 0);
return output;
}
12 changes: 12 additions & 0 deletions codewars/Sum of pairs/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function sumPairs(ints, s) {
const pastValue = {};
for (let i = 0; i < ints.length; i++) {
const current = ints[i];
const c = s - current;
if (pastValue[c] !== undefined) {
return [c, current];
}
pastValue[current] = i;
}
return undefined;
}
25 changes: 25 additions & 0 deletions codewars/Tic-Tac-Toe Checker/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
function isSolved(board) {
if (board[0][0] === board[1][1] && board[1][1] === board[2][2] && board[0][0] !== 0) {
return board[0][0];
}
if (board[0][2] === board[1][1] && board[1][1] === board[2][0] && board[0][2] !== 0) {
return board[0][2];
}
for (let i = 0; i < 3; i++) {
if (board[i][0] === board[i][1] && board[i][1] === board[i][2] && board[i][0] !== 0) {
return board[i][0];
}
if (board[0][i] === board[1][i] && board[1][i] === board[2][i] && board[0][i] !== 0) {
return board[0][i];
}
}

for (let i = 0; i < 3; i++) {
for (let j = 0; j < 3; j++) {
if (board[i][j] === 0) {
return -1;
}
}
}
return 0;
}
17 changes: 17 additions & 0 deletions codewars/Valid Parentheses/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
function validParentheses(parens) {
const stack = [];
const matchingParenthesis = { ')': '(' };

for (let i = 0; i < parens.length; i++) {
const currentChar = parens[i];

if (currentChar === '(') {
stack.push(currentChar);
} else if (currentChar === ')') {
if (stack.length === 0 || stack.pop() !== matchingParenthesis[currentChar]) {
return false;
}
}
}
return stack.length === 0;
}
7 changes: 7 additions & 0 deletions codewars/Where my anagrams at/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function anagrams(word, words) {
const sortedWord = word.split('').sort().join('');
return words.filter(wrd => {
const sortedWrd = wrd.split('').sort().join('');
return sortedWrd === sortedWord;
});
}
16 changes: 8 additions & 8 deletions onlineshop/source/client/src/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
// import React from 'react';
// import { render, screen } from '@testing-library/react';

import App from './App';
// import App from './App';

test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});
// test('renders learn react link', () => {
// render(<App />);
// const linkElement = screen.getByText(/learn react/i);
// expect(linkElement).toBeInTheDocument();
// });
Loading