Skip to content

Commit faa1e46

Browse files
committed
add readme entries
1 parent ddaefb6 commit faa1e46

8 files changed

+78
-15
lines changed

1301-1400/1389-create-target-array-in-the-given-order.js

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/*
2+
Author :- Rishabh Jain <contact@rishabh1403.com>
3+
Solution for :- https://leetcode.com/problems/create-target-array-in-the-given-order/
4+
blog for this code :- https://rishabh1403.com/posts/coding/leetcode/
5+
youtube video :- https://youtu.be/vZ6VpUJk7CU
6+
*/
7+
18
var createTargetArray = function(nums, index) {
29

310
return index.reduce((acc,el,idx) => {

201-300/205-isomorphic-strings.js

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/*
2+
Author :- Rishabh Jain <contact@rishabh1403.com>
3+
Solution for :- https://leetcode.com/problems/isomorphic-strings/
4+
blog for this code :- https://rishabh1403.com/posts/coding/leetcode/
5+
youtube video :- https://youtu.be/h0O_iPBhxTs
6+
*/
7+
18
var isIsomorphic = function (s, t) {
29
if (s.length !== t.length) return false;
310

301-400/345-reverse-vowels-of-a-string.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1+
/*
2+
Author :- Rishabh Jain <contact@rishabh1403.com>
3+
Solution for :- https://leetcode.com/problems/reverse-vowels-of-a-string/
4+
blog for this code :- https://rishabh1403.com/posts/coding/leetcode/
5+
youtube video :- https://youtu.be/5g6iV76aR-E
6+
*/
7+
18
var reverseVowels = function (s) {
29
const arr = s.split("");
310

4-
let left = 0, right = arr.length;
11+
let left = 0, right = arr.length - 1;
512

613
const vowels = ['A', 'E', 'I', 'O', 'U', 'a', 'e', 'i', 'o', 'u']
714

301-400/349-intersection-of-two-arrays.js

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/*
2+
Author :- Rishabh Jain <contact@rishabh1403.com>
3+
Solution for :- https://leetcode.com/problems/intersection-of-two-arrays/
4+
blog for this code :- https://rishabh1403.com/posts/coding/leetcode/
5+
youtube video :- https://youtu.be/3OBr0wzEtWE
6+
*/
7+
18
var intersection = function (nums1, nums2) {
29
const set1 = new Set(nums1);
310
const set2 = new Set(nums2);

301-400/374-guess-number-higher-or-lower.js

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/*
2+
Author :- Rishabh Jain <contact@rishabh1403.com>
3+
Solution for :- https://leetcode.com/problems/guess-number-higher-or-lower/
4+
blog for this code :- https://rishabh1403.com/posts/coding/leetcode/
5+
youtube video :- https://youtu.be/h0uL59Z9Hoc
6+
*/
7+
18
var guessNumber = function (n) {
29

310
if (guess(n) === 0) return n

301-400/383-ransom-note.js

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/*
2+
Author :- Rishabh Jain <contact@rishabh1403.com>
3+
Solution for :- https://leetcode.com/problems/ransom-note/
4+
blog for this code :- https://rishabh1403.com/posts/coding/leetcode/
5+
youtube video :- https://youtu.be/PkxRhIsvvf8
6+
*/
7+
18
var canConstruct = function (ransomNote, magazine) {
29
const map = new Map();
310

Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
1-
var firstUniqChar = function(s) {
1+
/*
2+
Author :- Rishabh Jain <contact@rishabh1403.com>
3+
Solution for :- https://leetcode.com/problems/first-unique-character-in-a-string/
4+
blog for this code :- https://rishabh1403.com/posts/coding/leetcode/
5+
youtube video :- https://youtu.be/rxVNTwf_zfg
6+
*/
7+
8+
var firstUniqChar = function (s) {
29
const map = new Map();
3-
4-
for(let i=0;i<s.length;i++){
5-
if(map.has(s[i])){
6-
map.set(s[i],-1)
7-
}else{
8-
map.set(s[i],i)
9-
}
10+
11+
for (let i = 0; i < s.length; i++) {
12+
if (map.has(s[i])) {
13+
map.set(s[i], -1)
14+
} else {
15+
map.set(s[i], i)
16+
}
1017
}
11-
for(let [key,value] of map){
12-
if(value !== -1){
13-
return value;
14-
}
18+
for (let [key, value] of map) {
19+
if (value !== -1) {
20+
return value;
21+
}
1522
}
16-
23+
1724
return -1;
1825
};

README.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ Solutions of all the questions from Leetcode in JavaScript.
2828

2929
- 169.Majority Element - [Question](https://leetcode.com/problems/majority-element/) | [Source Code](https://github.com/rishabh1403/leetcode-javascript-solutions/blob/master/101-200/169-majority-element.js) | [Blog](https://rishabh1403.com/posts/coding/leetcode/2020/04/leetcode-majority-element) | [Youtube Video](https://youtu.be/p0vvs4Gq8qY)
3030

31+
- 205.Isomorphic Strings - [Question]() | [Source Code]() | [Blog]() | [Youtube Video]()
32+
3133
- 217.Contains Duplicate - [Question](https://leetcode.com/problems/contains-duplicate/) | [Source Code](https://github.com/rishabh1403/leetcode-javascript-solutions/blob/master/201-300/217-contains-duplicate.js) | [Blog](https://rishabh1403.com/posts/coding/leetcode/2020/03/leetcode-contains-duplicate) | [Youtube Video](https://youtu.be/cuR5uyV8snc)
3234

3335
- 219.Contains Duplicate II - [Question](https://leetcode.com/problems/contains-duplicate-ii/) | [Source Code](https://github.com/rishabh1403/leetcode-javascript-solutions/blob/master/201-300/219-contains-duplicate-ii.js) | [Blog](https://rishabh1403.com/posts/coding/leetcode/2020/03/leetcode-contains-duplicate-ii) | [Youtube Video](https://youtu.be/O4MF2wBOrTM)
@@ -38,6 +40,16 @@ Solutions of all the questions from Leetcode in JavaScript.
3840

3941
- 344.Reverse String - [Question](https://leetcode.com/problems/reverse-string/) | [Source Code](https://github.com/rishabh1403/leetcode-javascript-solutions/blob/master/301-400/344-reverse-string.js) | [Blog](https://rishabh1403.com/posts/coding/leetcode/2020/04/leetcode-reverse-string) | [Youtube Video](https://youtu.be/8j24rPjGBwU)
4042

43+
- 345.Reverse Vowels of a String - [Question]() | [Source Code]() | [Blog]() | [Youtube Video]()
44+
45+
- 349.Intersection of Two Arrays - [Question]() | [Source Code]() | [Blog]() | [Youtube Video]()
46+
47+
- 374.Guess Number Higher or Lower - [Question]() | [Source Code]() | [Blog]() | [Youtube Video]()
48+
49+
- 383.Ransom Note - [Question]() | [Source Code]() | [Blog]() | [Youtube Video]()
50+
51+
- 387.First Unique Character in a String - [Question]() | [Source Code]() | [Blog]() | [Youtube Video]()
52+
4153
- 509.Fibonacci Number - [Question](https://leetcode.com/problems/fibonacci-number/) | [Source Code](https://github.com/rishabh1403/leetcode-javascript-solutions/blob/master/501-600/509-fibonacci-number.js) | [Blog](https://rishabh1403.com/posts/coding/leetcode/2020/04/leetcode-fibonacci-number) | [Youtube Video](https://youtu.be/iyyhQfO_KKY)
4254

4355
- 709.To Lower Case - [Question](https://leetcode.com/problems/to-lower-case/) | [Source Code](https://github.com/rishabh1403/leetcode-javascript-solutions/blob/master/701-800/709-to-lower-case.js) | [Blog](https://rishabh1403.com/posts/coding/leetcode/2020/03/leetcode-to-lower-case) | [Youtube Video](https://youtu.be/jFi7-YgIXJQ)
@@ -62,4 +74,6 @@ Solutions of all the questions from Leetcode in JavaScript.
6274

6375
- 1342.Number of Steps to Reduce a Number to Zero - [Question](https://leetcode.com/problems/number-of-steps-to-reduce-a-number-to-zero/) | [Source Code](https://github.com/rishabh1403/leetcode-javascript-solutions/blob/master/1301-1400/1342-reduce-numer-to-zero.js) | [Blog](https://rishabh1403.com/posts/coding/leetcode/2020/03/leetcode-number-of-steps-to-reduce-a-number-to-zero) | [Youtube Video](https://www.youtube.com/watch?v=sQYhrMf1VMc)
6476

65-
- 1365.How Many Numbers Are Smaller Than the Current Number - [Question](https://leetcode.com/problems/how-many-numbers-are-smaller-than-the-current-number/) | [Source Code](https://github.com/rishabh1403/leetcode-javascript-solutions/blob/master/1301-1400/1365-how-many-numbers-smaller-than-current-number.js) | [Blog](https://rishabh1403.com/posts/coding/leetcode/2020/03/leetcode-how-many-numbers-smaller-than-current-number) | [Youtube Video](https://youtu.be/a2RWy9kqOhs)
77+
- 1365.How Many Numbers Are Smaller Than the Current Number - [Question](https://leetcode.com/problems/how-many-numbers-are-smaller-than-the-current-number/) | [Source Code](https://github.com/rishabh1403/leetcode-javascript-solutions/blob/master/1301-1400/1365-how-many-numbers-smaller-than-current-number.js) | [Blog](https://rishabh1403.com/posts/coding/leetcode/2020/03/leetcode-how-many-numbers-smaller-than-current-number) | [Youtube Video](https://youtu.be/a2RWy9kqOhs)
78+
79+
- 1389.Create Target Array in the Given Order - [Question]() | [Source Code]() | [Blog]() | [Youtube Video]()

0 commit comments

Comments
 (0)