-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alexander Petrovskiy
committed
Nov 18, 2023
1 parent
a31f820
commit 02a584c
Showing
25 changed files
with
258 additions
and
320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 24 additions & 38 deletions
62
src/main/java/challenges/c20201001_20201007/CombinationSum/combination_sum.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,24 @@ | ||
const { combinationSum } = require("./combination_sum"); | ||
|
||
describe.each([ | ||
[ | ||
[2, 3, 6, 7], 8, [ | ||
[2, 2, 3], | ||
[7] | ||
] | ||
], | ||
[ | ||
[2, 3, 5], | ||
8, [ | ||
[2, 2, 2, 2], | ||
[2, 3, 3], | ||
[3, 5], | ||
], | ||
], | ||
[ | ||
[2], 1, [] | ||
], | ||
[ | ||
[1], 1, [ | ||
[1] | ||
] | ||
], | ||
[ | ||
[1], 2, [ | ||
[1, 1] | ||
] | ||
], | ||
])( | ||
"combinationSum(%o, %i) should equal %i", | ||
(candidates, target, expectedResult) => { | ||
test(`candidates = ${candidates}, target = ${target}, returns ${expectedResult}`, () => { | ||
expect(combinationSum(candidates, target)).toEqual(expectedResult); | ||
}); | ||
} | ||
); | ||
const { combinationSum } = require("./combination_sum"); | ||
|
||
describe.each([ | ||
[[2, 3, 6, 7], 8, [[2, 2, 3], [7]]], | ||
[ | ||
[2, 3, 5], | ||
8, | ||
[ | ||
[2, 2, 2, 2], | ||
[2, 3, 3], | ||
[3, 5], | ||
], | ||
], | ||
[[2], 1, []], | ||
[[1], 1, [[1]]], | ||
[[1], 2, [[1, 1]]], | ||
])( | ||
"combinationSum(%o, %i) should equal %i", | ||
(candidates, target, expectedResult) => { | ||
test(`candidates = ${candidates}, target = ${target}, returns ${expectedResult}`, () => { | ||
expect(combinationSum(candidates, target)).toEqual(expectedResult); | ||
}); | ||
} | ||
); |
4 changes: 1 addition & 3 deletions
4
src/main/java/challenges/c20201001_20201007/CombinationSum/solution.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
function combinationSum(candidates: number[], target: number): number[][] { | ||
|
||
}; | ||
function combinationSum(candidates: number[], target: number): number[][] {} |
13 changes: 4 additions & 9 deletions
13
src/main/java/challenges/c20201001_20201007/NumberOfRecentCalls/code.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 2 additions & 7 deletions
9
src/main/java/challenges/c20201001_20201007/NumberOfRecentCalls/code.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,11 @@ | ||
class RecentCounter { | ||
constructor() { | ||
constructor() {} | ||
|
||
} | ||
|
||
ping(t: number): number { | ||
|
||
} | ||
ping(t: number): number {} | ||
} | ||
|
||
/** | ||
* Your RecentCounter object will be instantiated and called as such: | ||
* var obj = new RecentCounter() | ||
* var param_1 = obj.ping(t) | ||
*/ | ||
|
16 changes: 8 additions & 8 deletions
16
...in/java/challenges/c20210101_20210107/CheckArrayFormationThroughConcatenation/solution.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
/** | ||
* @param {number[]} arr | ||
* @param {number[][]} pieces | ||
* @return {boolean} | ||
*/ | ||
var canFormArray = function(arr, pieces) { | ||
return false; | ||
}; | ||
/** | ||
* @param {number[]} arr | ||
* @param {number[][]} pieces | ||
* @return {boolean} | ||
*/ | ||
var canFormArray = function (arr, pieces) { | ||
return false; | ||
}; |
6 changes: 3 additions & 3 deletions
6
...in/java/challenges/c20210101_20210107/CheckArrayFormationThroughConcatenation/solution.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
function canFormArray(arr: number[], pieces: number[][]): boolean { | ||
return false; | ||
}; | ||
function canFormArray(arr: number[], pieces: number[][]): boolean { | ||
return false; | ||
} |
32 changes: 15 additions & 17 deletions
32
...nges/c20210101_20210107/FindACorrespondingNodeOfABinaryTreeInACloneOfThatTree/solution.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
/** | ||
* Definition for a binary tree node. | ||
* function TreeNode(val) { | ||
* this.val = val; | ||
* this.left = this.right = null; | ||
* } | ||
*/ | ||
/** | ||
* @param {TreeNode} original | ||
* @param {TreeNode} cloned | ||
* @param {TreeNode} target | ||
* @return {TreeNode} | ||
*/ | ||
|
||
var getTargetCopy = function(original, cloned, target) { | ||
|
||
}; | ||
/** | ||
* Definition for a binary tree node. | ||
* function TreeNode(val) { | ||
* this.val = val; | ||
* this.left = this.right = null; | ||
* } | ||
*/ | ||
/** | ||
* @param {TreeNode} original | ||
* @param {TreeNode} cloned | ||
* @param {TreeNode} target | ||
* @return {TreeNode} | ||
*/ | ||
|
||
var getTargetCopy = function (original, cloned, target) {}; |
36 changes: 19 additions & 17 deletions
36
...nges/c20210101_20210107/FindACorrespondingNodeOfABinaryTreeInACloneOfThatTree/solution.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
/** | ||
* Definition for a binary tree node. | ||
* class TreeNode { | ||
* val: number | ||
* left: TreeNode | null | ||
* right: TreeNode | null | ||
* constructor(val?: number, left?: TreeNode | null, right?: TreeNode | null) { | ||
* this.val = (val===undefined ? 0 : val) | ||
* this.left = (left===undefined ? null : left) | ||
* this.right = (right===undefined ? null : right) | ||
* } | ||
* } | ||
*/ | ||
|
||
function getTargetCopy(original: TreeNode | null, cloned: TreeNode | null, target: TreeNode | null): TreeNode | null { | ||
|
||
}; | ||
/** | ||
* Definition for a binary tree node. | ||
* class TreeNode { | ||
* val: number | ||
* left: TreeNode | null | ||
* right: TreeNode | null | ||
* constructor(val?: number, left?: TreeNode | null, right?: TreeNode | null) { | ||
* this.val = (val===undefined ? 0 : val) | ||
* this.left = (left===undefined ? null : left) | ||
* this.right = (right===undefined ? null : right) | ||
* } | ||
* } | ||
*/ | ||
|
||
function getTargetCopy( | ||
original: TreeNode | null, | ||
cloned: TreeNode | null, | ||
target: TreeNode | null | ||
): TreeNode | null {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 9 additions & 9 deletions
18
src/main/java/problems/easy/ClimbingStairs/climbing_stairs.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
const { climbStairs } = require("./climbing_stairs"); | ||
|
||
describe.each([ | ||
[1, 1], | ||
[2, 2], | ||
[3, 3], | ||
[4, 5], | ||
[5, 8], | ||
[1, 1], | ||
[2, 2], | ||
[3, 3], | ||
[4, 5], | ||
[5, 8], | ||
])("climbStairs(%i) should equal %i", (input, expectedResult) => { | ||
test(`input = {input}, returns = {expectedResult}`, () => { | ||
expect(climbStairs(input)).toEqual(expectedResult); | ||
}); | ||
}); | ||
test(`input = {input}, returns = {expectedResult}`, () => { | ||
expect(climbStairs(input)).toEqual(expectedResult); | ||
}); | ||
}); |
18 changes: 9 additions & 9 deletions
18
src/main/java/problems/easy/DegreeOfAnArray/degree_of_an_array.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
/** | ||
* @param {number[]} nums | ||
* @return {number} | ||
*/ | ||
var findShortestSubArray = function(nums) { | ||
return 0; | ||
}; | ||
|
||
module.exports = { findShortestSubArray }; | ||
/** | ||
* @param {number[]} nums | ||
* @return {number} | ||
*/ | ||
var findShortestSubArray = function (nums) { | ||
return 0; | ||
}; | ||
|
||
module.exports = { findShortestSubArray }; |
24 changes: 10 additions & 14 deletions
24
src/main/java/problems/easy/DegreeOfAnArray/degree_of_an_array.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,10 @@ | ||
const { findShortestSubArray } = require("./degree_of_an_array"); | ||
|
||
describe.each([ | ||
[ | ||
[1, 2, 2, 3, 1], 2 | ||
], | ||
[ | ||
[1, 2, 2, 3, 1, 4, 2], 6 | ||
], | ||
])("findShortestSubArray(%o) should equal %i", (inputArray, expectedResult) => { | ||
test(`inputArray = {inputArray} returns {expectedResult}`, () => { | ||
expect(findShortestSubArray(inputArray)).toEqual(expectedResult); | ||
}); | ||
}); | ||
const { findShortestSubArray } = require("./degree_of_an_array"); | ||
|
||
describe.each([ | ||
[[1, 2, 2, 3, 1], 2], | ||
[[1, 2, 2, 3, 1, 4, 2], 6], | ||
])("findShortestSubArray(%o) should equal %i", (inputArray, expectedResult) => { | ||
test(`inputArray = {inputArray} returns {expectedResult}`, () => { | ||
expect(findShortestSubArray(inputArray)).toEqual(expectedResult); | ||
}); | ||
}); |
6 changes: 3 additions & 3 deletions
6
src/main/java/problems/easy/DegreeOfAnArray/degree_of_an_array.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
function findShortestSubArray(nums: number[]): number { | ||
return 0; | ||
}; | ||
function findShortestSubArray(nums: number[]): number { | ||
return 0; | ||
} |
Oops, something went wrong.