Skip to content

Commit 946d564

Browse files
committed
First commit with one task solved
0 parents  commit 946d564

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
File test.js has solutions to some Leetcode Top 150 interview tasks.
2+
3+
Respective functions with solutions are added individually and previous ones are commented.
4+
5+
To run and test the required approach:
6+
7+
1. Comment on all other functions
8+
2. Open index.html in a browser
9+
3. See the result in the console log (Dev tools)
10+
11+
New solutions are added from time to time.

index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>JavaScript Leetcode Top 150 interview</title>
5+
<meta charset="UTF-8" />
6+
</head>
7+
8+
<body>
9+
<script src="test.js" type="text/javascript"></script>
10+
</body>
11+
</html>

test.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//----- -----
2+
//----- Merge Sorted Array -----
3+
//----- -----
4+
5+
const nums1 = [1, 2, 3, 0, 0, 0];
6+
const nums2 = [2, 5, 6];
7+
const m = (n = 3);
8+
9+
const merge = function (nums1, m, nums2, n) {
10+
nums1.splice(m, n);
11+
nums1.push(...nums2);
12+
nums1.sort((a, b) => a - b);
13+
14+
// console.log(nums1); use to see result
15+
};
16+
17+
merge(nums1, m, nums2, n);

0 commit comments

Comments
 (0)