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
@@ -67,6 +72,8 @@ You can modify the input array in-place.
67
72
68
73
[JS](pb4/answer.js) (3:47)
69
74
75
+
---
76
+
70
77
## 5
71
78
> This problem was asked by Jane Street.
72
79
@@ -86,12 +93,15 @@ Implement car and cdr.
86
93
87
94
[JS](pb5/answer.js) (Not timed)
88
95
96
+
---
97
+
89
98
## 6
90
99
> This problem was asked by Google.
91
100
92
101
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.
93
102
If using a language that has no pointers (such as Python), you can assume you have access to get_pointer and dereference_pointer functions that converts between nodes and memory addresses.
94
103
104
+
---
95
105
96
106
### 7
97
107
> This problem was asked by Facebook.
@@ -105,6 +115,8 @@ You can assume that the messages are decodable. For example, '001' is not allowe
105
115
106
116
[JS](pb7/answer.js) (Not timed, very long)
107
117
118
+
---
119
+
108
120
### 8
109
121
> This problem was asked by Google.
110
122
@@ -125,3 +137,24 @@ For example, the following tree has 5 unival subtrees:
125
137
## Solution
126
138
127
139
[JS](pb8/answer.js) (Not timed)
140
+
141
+
---
142
+
143
+
### 9
144
+
145
+
> This problem was asked by Airbnb.
146
+
147
+
Given a list of integers, write a function that returns the largest sum of non-adjacent numbers. Numbers can be 0 or negative.
148
+
For example, `[2, 4, 6, 2, 5]` should return `13`, since we pick 2, 6, and 5. `[5, 1, 1, 5]` should return `10`, since we pick 5 and 5.
149
+
Follow-up: Can you do this in O(N) time and constant space?
150
+
151
+
---
152
+
153
+
### 10
154
+
> This problem was asked by Apple.
155
+
156
+
Implement a job scheduler which takes in a function f and an integer n, and calls f after n milliseconds.
0 commit comments