You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Readme.md
+20-22Lines changed: 20 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -6,11 +6,11 @@
6
6
7
7
## 🚀 Problem 1 [Easy]
8
8
9
-
This problem was recently asked by Google.
9
+
#### This problem was recently asked by Google.
10
10
11
-
Given a list of numbers and a number k, return whether any two numbers
12
-
rom the list add up to k.
13
-
For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17.
11
+
Given a list of numbers and a number `k`, return whether any two numbers
12
+
rom the list add up to `k`.
13
+
For example, given `[10, 15, 3, 7]` and `k` of `17`, return true since `10 + 7` is `17`.
14
14
15
15
Bonus: Can you do this in one pass?
16
16
@@ -20,15 +20,15 @@ Bonus: Can you do this in one pass?
20
20
21
21
## 🚀 Problem 2 [Easy]
22
22
23
-
This problem was asked by Uber.
23
+
#### This problem was asked by Uber.
24
24
25
25
Given an array of integers, return a new array such that each element
26
-
at index i of the new array is the product of all the numbers in the
27
-
original array except the one at i.
26
+
at index `i` of the new array is the product of all the numbers in the
27
+
original array except the one at `i`.
28
28
29
-
For example, if our input was [1, 2, 3, 4, 5], the expected output
30
-
would be [120, 60, 40, 30, 24]. If our input was [3, 2, 1],
31
-
the expected output would be [2, 3, 6].
29
+
For example, if our input was `[1, 2, 3, 4, 5]`, the expected output
30
+
would be `[120, 60, 40, 30, 24]`. If our input was `[3, 2, 1]`,
31
+
the expected output would be `[2, 3, 6]`.
32
32
33
33
Follow-up: what if you can't use division?
34
34
@@ -38,9 +38,9 @@ Follow-up: what if you can't use division?
38
38
39
39
## 🚀 Problem 3 [Medium]
40
40
41
-
This problem was asked by Google.
41
+
#### This problem was asked by Google.
42
42
43
-
Given the root to a binary tree, implement serialize(root), which serializes the tree into a string, and deserialize(s), which deserializes the string back into the tree.
43
+
Given the root to a binary tree, implement `serialize(root)`, which serializes the tree into a string, and `deserialize(s)`, which deserializes the string back into the tree.
Given an array of integers, find the first missing positive integer in linear time and constant space. In other words, find the lowest positive integer that does not exist in the array. The array can contain duplicates and negative numbers as well.
76
76
@@ -84,9 +84,9 @@ You can modify the input array in-place.
84
84
85
85
## 🚀 Problem 5 [Medium]
86
86
87
-
This problem was asked by Jane Street.
87
+
#### This problem was asked by Jane Street.
88
88
89
-
cons(a, b) constructs a pair, and car(pair) and cdr(pair) returns the first and last element of that pair. For example, car(cons(3, 4)) returns 3, and cdr(cons(3, 4)) returns 4.
89
+
`cons(a, b)` constructs a pair, and `car(pair)` and `cdr(pair)` returns the first and last element of that pair. For example, `car(cons(3, 4))` returns 3, and `cdr(cons(3, 4))` returns 4.
90
90
91
91
Given this implementation of cons:
92
92
@@ -109,7 +109,7 @@ Implement car and cdr.
109
109
110
110
## 🚀 Problem 6 [Hard]
111
111
112
-
This problem was asked by Google.
112
+
#### This problem was asked by Google.
113
113
114
114
An XOR linked list is a more memory efficient doubly linked list. Instead of each node holding next and prev fields, it holds a field named both, which is an XOR of the next node and the previous node. Implement an XOR linked list; it has an `add(element)` which adds the element to the end, and a `get(index)` which returns the node at index.
115
115
@@ -122,13 +122,11 @@ If using a language that has no pointers (such as Python), you can assume you ha
122
122
123
123
## 🚀 Problem 7 [Medium]
124
124
125
-
This problem was asked by Facebook.
125
+
#### This problem was asked by Facebook.
126
126
127
-
Given the mapping a = 1, b = 2, ... z = 26, and an encoded message, count the number of ways it can be decoded.
128
-
129
-
For example, the message '111' would give 3, since it could be decoded as 'aaa', 'ka', and 'ak'.
130
-
131
-
You can assume that the messages are decodable. For example, '001' is not allowed.
127
+
Given the mapping `a = 1, b = 2, ... z = 26`, and an encoded message, count the number of ways it can be decoded.
128
+
For example, the message `'111'` would give 3, since it could be decoded as `'aaa'`, `'ka'`, and `'ak'`.
129
+
You can assume that the messages are decodable. For example, `'001'` is not allowed.
0 commit comments