Skip to content

Commit 22737fd

Browse files
BarklimBarklim
Barklim
authored and
Barklim
committed
Create 1768.js
1 parent ff29dd0 commit 22737fd

File tree

2 files changed

+246
-0
lines changed

2 files changed

+246
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* 1768. Merge Strings Alternately
3+
* https://leetcode.com/problems/merge-strings-alternately/
4+
* Difficulty: Easy
5+
*
6+
* You are given two strings word1 and word2. Merge the strings by adding letters in alternating
7+
* order, starting with word1. If a string is longer than the other, append the additional
8+
* letters onto the end of the merged string.
9+
*
10+
* Return the merged string.
11+
*/
12+
13+
/**
14+
* @param {string} word1
15+
* @param {string} word2
16+
* @return {string}
17+
*/
18+
var mergeAlternately = function(word1, word2) {
19+
20+
};
21+
22+
const example1 = mergeAlternately("abc", "pqr"); // "apbqcr"
23+
const example2 = mergeAlternately("ab","pqrs"); // "apbqrs"
24+
const example3 = mergeAlternately("abcd", "pq"); // "apbqcd"
25+
const example4 = mergeAlternately("12", "some"); // "1s2ome"
26+
const example5 = mergeAlternately("1234", "so"); // "1s2o34"
27+
28+
console.log(example1);
29+
console.log(example2);
30+
console.log(example3);
31+
console.log(example4);
32+
console.log(example5);
33+
34+
// var mergeAlternately = function(word1, word2) {
35+
// let result = ''
36+
37+
// for (let i = 0; i < Math.max(word1.length, word2.length); i++) {
38+
// if (i < word1.length) result += word1[i];
39+
// if (i < word2.length) result += word2[i];
40+
// }
41+
// return result
42+
// };

example/README.md

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
# Order
2+
3+
Better order to solve problems
4+
5+
## Lists
6+
7+
### [0.ArraaysHash](https://github.com/Barklim/leetcode-javascript/tree/master/example/0.ArraysHash)
8+
9+
1. Two sum
10+
167. Two Integer Sum II
11+
0.
12+
217. Contains Duplicate
13+
242. Valid Anagram
14+
49. Group Anagrams
15+
347. Top K Frequent Elements
16+
271. Encode Decode
17+
238. Product of Array Except Self
18+
36. Valid Sudoku
19+
128. Longest Consecutive Sequence
20+
21+
### [1.TwoPointers](https://github.com/Barklim/leetcode-javascript/tree/master/example/1.TwoPointers)
22+
23+
344. Reverse string leetcode
24+
125. Valid Palendrom
25+
15. 3sum
26+
977. Squares of a sorted Array
27+
11. Container With Most Water
28+
26. Remove duplicates
29+
283. Move Zeroes
30+
392. Ls Subseq
31+
844. Backspace String compare
32+
88. Merge sorted Array
33+
0.
34+
42. Trapping Rain Water
35+
36+
### [2.SlidingWindow](https://github.com/Barklim/leetcode-javascript/tree/master/example/2.SlidingWindow)
37+
38+
643. Maximum Average Subarray
39+
209. Minimum size Subarray Sum
40+
1004. Max Consecutive One iii
41+
1493. Longest Subarray of 1s After Deleting One Element
42+
904. Fruit Into Baskets
43+
0.
44+
121. Best Time to Buy and Sell Stock
45+
424. Longest Repeating Character Replacement
46+
47+
### Linked list
48+
49+
707. Design Linked List
50+
876. Middle of the Linked List
51+
2095. Delete the Middle Node of a Linked List
52+
206. Reverse Linked List
53+
234. Palindrome Linked List
54+
83. Remove Duplicates from Sorted List
55+
19. Remove Nth Node from End of List
56+
43. Swap Nodes in Pairs
57+
21. Merge Two sorted Lists
58+
141. Linked List Cycle
59+
60+
### HashMap
61+
62+
706. Design Hash map
63+
64+
### LRU Cache
65+
66+
146. LRU Cache
67+
68+
### Stack, Queue
69+
70+
20. Valid Parentheses
71+
1047. Remove All Adjacent duplicates in String
72+
2390. Removing Stars From a string
73+
71. Simplify Path
74+
933. Number of Recent Calls
75+
76+
### Binare Tree, DFS
77+
78+
104. Maximum Depth of Binary Tree
79+
226. Invert Binary Tree
80+
101. Symmetric Tree
81+
100. Same Tree
82+
112. Path sum
83+
84+
### Binary Search Tree
85+
86+
700. Search in a Binary search tree
87+
701. Insert into a Binary search tree
88+
98. Validate Binary Search tree (нужно следить за диапозоном хранимых/возможным значений)
89+
110. Balanced Binary tree
90+
91+
### Binary Tree, BFS
92+
93+
102. Binary Tree Level Order Traversal
94+
515. Find Largest Value in Each Tree Row
95+
199. Binary Tree Right Side View
96+
117. Populating Next Right Pointers in Each Node ii
97+
1325. Delete Leaves With a Given Value
98+
1302. Deepest Leaves Sum
99+
543. Diameter of Binary Tree (104 task)
100+
103. Binary Tree Zigzag level Order Traversal
101+
236. Lowest Common Ancestor of a Binary tree
102+
103+
### Trie, Autocomplete
104+
105+
208. Implement trie
106+
1268. Search suggestion system
107+
108+
### Heap Pt.1
109+
110+
215. Kth Largest Element in an Array (минхипа максхипа)
111+
703. Kth Largest Element in a Stream
112+
347. Top K Frequent Elements
113+
451. Sort Characters By Frequency
114+
115+
### Heap Pt.2
116+
117+
1046. Last stone Weight
118+
502. IPO
119+
295. Find Median from Data Stream
120+
1962. Remove stones to minimize the total
121+
23. Merge k sorted Lists
122+
642. Design Search Autocomplete System
123+
124+
### Intervals
125+
126+
252. Meeting Rooms (сортировать по дате начала митинга)
127+
56. Merge Intervals
128+
57. Insert Intervals
129+
253. Meeting Rooms ii
130+
131+
### Graphs Workshop
132+
133+
752. Open the lock
134+
433. Minimum Genetic Mutation
135+
2101. Detonation the Maximum Bombs
136+
841. Keys and rooms
137+
1971. Find if path Exists in Graph
138+
133. clone graph
139+
1557. Minimum number of Vertices to Reach All Nodes
140+
141+
### Graphs Workshop 2
142+
143+
323. Number of Connected components in an Undirected Graph (547. none premium)
144+
200. Number of Islands
145+
1466. Reorder Routes to Make All Paths Lead to the City Zero
146+
695. Max Area of island
147+
2368. Reachable Nodes with restrictions
148+
542. 01 Matrix
149+
994. Rotting oranges
150+
1129. Shortest Path with Alternating Colors
151+
1926. Nearest Exit from Entrance in Maze
152+
1091. Shortest path in Binary Matrix
153+
433. Minimum Genetic mutation (752.)
154+
155+
### Dijkstra
156+
157+
743. Network delay time
158+
1514. Path with maximum Probability
159+
787. Cheapest Flights Within K Stops
160+
161+
### Topological sort Pt.1
162+
163+
2115. Find all possible Recipes from given Supplies
164+
165+
### Topological sort Pt.2
166+
167+
207. Course Schedule
168+
210. Course Schedule ii
169+
1136. Parallel Courses
170+
171+
### Backtracking Pt.1
172+
173+
46. Permutations
174+
77. Combinations
175+
78. Subsets
176+
22. Generate Paretheses
177+
178+
### Backtracking Pt.2
179+
180+
216. Combination Sum iii
181+
17. letter combinations of a phone number
182+
51. N-Queens
183+
489. Robot room cleaner
184+
185+
### Dynamic Programming Pt.1
186+
187+
509. Fibonacci Number
188+
70. Climbing Stairs
189+
746. Min Cost Climbing Stairs
190+
322. Coin Change
191+
198. House Robber
192+
193+
### Dynamic Programming Pt.2
194+
195+
91. Decode ways
196+
62. Unique paths
197+
64. Minimum path sum
198+
72. Edit Distance
199+
200+
## Programming skills
201+
202+
### [0.Basic](https://github.com/Barklim/leetcode-javascript/tree/master/example/ProgrammingSkills/0.Basic)
203+
204+
1768. Merge Strings Alternately

0 commit comments

Comments
 (0)