This repository is a collection of solutions for Daily Coding Problem problems.
"A daily coding problem a day keeps the unemployment away..."
- Madeline Moore - mcmoore11
- told Peter about the DCPs... he had already been subscribed for over a year
- managed all folders
- Peter Zhang - PeterTheAmazingAsian
- made the readme lol
- subcribed to DCP for way too long
Below we have a table of all the DCPs (1-399). The table contains the question number/day, the company that asked the question, a brief description, difficulty, and a link to goto the corresponding folder. There are also two additional columns to show who has completed which problems and in which languages.
Day | Company | Description | Difficulty | Madeline | Peter | Link |
---|---|---|---|---|---|---|
001 | Given a list of numbers and a number k, return whether any two numbers from the list add up to k. | Easy | Python | C++, Python | go | |
002 | Uber | Given an array of integers, return a new array such that each element at index i of the new array is the product of all the numbers in the original array except the one at i. | Hard | Python | C++, Python | go |
003 | 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. | Medium | - | C++, Python | go | |
004 | Stripe | 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. | Hard | - | C++, Python | go |
005 | Jane Street | Implement car and cdr. cons(a, b) constructs a pair, and car(pair) and cdr(pair) returns the first and last element of that pair. | Medium | - | C++, Python | go |
006 | 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. | Hard | - | C++ | go | |
007 | Given the mapping a = 1, b = 2, ... z = 26, and an encoded message, count the number of ways it can be decoded. | Medium | - | - | go | |
008 | Given the root to a binary tree, count the number of unival subtrees. | Easy | - | C++ | go | |
009 | Airbnb | Given a list of integers, write a function that returns the largest sum of non-adjacent numbers. Numbers can be 0 or negative. | Hard | - | - | go |
010 | Apple | Implement a job scheduler which takes in a function f and an integer n, and calls f after n milliseconds. | Medium | - | - | go |
011 | Implement an autocomplete system. That is, given a query string s and a set of all possible query strings, return all strings in the set that have s as a prefix. | Medium | - | C++ | go | |
012 | Amazon | There exists a staircase with N steps, and you can climb up either 1 or 2 steps at a time. Given N, write a function that returns the number of unique ways you can climb the staircase. The order of the steps matters. | Hard | - | C++ | go |
013 | Amazon | Given an integer k and a string s, find the length of the longest substring that contains at most k distinct characters. | Hard | - | - | go |
014 | The area of a circle is defined as πr^2. Estimate π to 3 decimal places using a Monte Carlo method. | Medium | - | C++ | go | |
015 | Given a stream of elements too large to store in memory, pick a random element from the stream with uniform probability. | Medium | - | - | go | |
016 | You run an e-commerce website and want to record the last N order ids in a log. Implement a data structure to accomplish this | Easy | - | - | go | |
017 | Given a string representing the file system in the above format, return the length of the longest absolute path to a file in the abstracted file system. If there is no file in the system, return 0. | Hard | - | - | go | |
018 | Given an array of integers and a number k, where 1 <= k <= length of the array, compute the maximum values of each subarray of length k. | Hard | - | - | go | |
019 | Goal of minimizing cost while ensuring that no two neighboring houses are of the same color. Given an N by K matrix where the nth row and kth column represents the cost to build the nthhouse with kth color, return the minimum cost which achieves this goal. | Medium | - | - | go | |
020 | Given two singly linked lists that intersect at some point, find the intersecting node. The lists are non-cyclical. | Easy | - | - | go | |
021 | Snapchat | Given an array of time intervals (start, end) for classroom lectures (possibly overlapping), find the minimum number of rooms required. | Easy | - | - | go |
022 | Microsoft | Given a dictionary of words and a string made up of those words (no spaces), return the original sentence in a list. | Medium | - | C++ | go |
023 | You are given an M by N matrix consisting of booleans that represents a board. Each True boolean represents a wall. Each False boolean represents a tile you can walk on. Given this matrix, a start coordinate, and an end coordinate, return the minimum number of steps required to reach the end coordinate from the start. | Easy | - | - | go | |
024 | Implement locking in a binary tree. A binary tree node can be locked or unlocked only if all of its descendants or ancestors are not locked. | Medium | - | C++ | go | |
025 | Implement regular expression matching with the following special characters: . and * | Hard | - | - | go | |
026 | - | Medium | - | - | go | |
027 | - | Easy | - | - | go | |
028 | Palantir | - | Medium | - | - | go |
029 | Amazon | - | Easy | - | - | go |
030 | - | Medium | - | - | go | |
031 | Given two strings, compute the edit distance between them. | Easy | - | C++ | go | |
032 | Jane Street | - | Hard | - | - | go |
033 | Microsoft | - | Easy | - | - | go |
034 | Quora | - | Medium | - | - | go |
035 | - | Hard | - | - | go | |
036 | Dropbox | - | Medium | - | - | go |
037 | The power set of a set is the set of all its subsets. Write a function that given a set, generates its power set. | Easy | - | C++ | go | |
038 | Microsoft | - | Hard | - | - | go |
039 | Dropbox | - | Medium | - | - | go |
040 | - | Hard | - | - | go | |
041 | - | Medium | - | - | go | |
042 | - | Hard | - | - | go | |
043 | Amazon | - | Easy | - | - | go |
044 | - | Medium | - | - | go | |
045 | Two Sigma | - | Easy | - | - | go |
046 | Amazon | - | Hard | - | - | go |
047 | - | Easy | - | - | go | |
048 | - | Medium | - | - | go | |
049 | Amazon | Given an array of numbers, find the maximum sum of any contiguous subarray of the array. | Medium | - | C++ | go |
050 | Microsoft | - | Easy | - | - | go |
051 | - | Medium | - | - | go | |
052 | - | Hard | - | - | go | |
053 | Apple | Implement a queue using two stacks. | Medium | - | C++ | go |
054 | Dropbox | - | Hard | - | - | go |
055 | Microsoft | - | Easy | - | - | go |
056 | - | Medium | - | - | go | |
057 | Amazon | - | Medium | - | - | go |
058 | Amazon | Given such an array, find the index of the element in the array in faster than linear time. | Medium | - | C++ | go |
059 | - | Hard | - | - | go | |
060 | - | Medium | - | - | go | |
061 | - | Medium | - | - | go | |
062 | - | Medium | - | - | go | |
063 | Microsoft | - | Easy | - | - | go |
064 | - | Hard | - | - | go | |
065 | Amazon | Given a N by M matrix of numbers, print out the matrix in a clockwise spiral. | Easy | - | C++ | go |
066 | Square | - | Medium | - | - | go |
067 | - | Hard | - | - | go | |
068 | - | Medium | - | - | go | |
069 | Given a list of integers, return the largest product that can be made by multiplying any three integers. | Easy | - | C++ | go | |
070 | Microsoft | - | Easy | - | - | go |
071 | Two Sigma | - | Easy | - | - | go |
072 | - | Hard | - | - | go | |
073 | - | Easy | - | - | go | |
074 | Apple | Given integers N and X, write a function that returns the number of times X appears as a value in an N by N multiplication table. | Medium | - | C++ | go |
075 | Microsoft | - | Hard | - | - | go |
076 | - | Medium | - | - | go | |
077 | Snapchat | - | Easy | - | - | go |
078 | - | Medium | - | - | go | |
079 | - | Medium | - | - | go | |
080 | - | Easy | - | - | go | |
081 | Yelp | - | Easy | - | - | go |
082 | Microsoft | - | Easy | - | - | go |
083 | - | Medium | - | - | go | |
084 | Amazon | - | Medium | - | - | go |
085 | - | Medium | - | - | go | |
086 | - | Medium | - | - | go | |
087 | Uber | - | Hard | - | - | go |
088 | ContextLogic | - | Medium | - | - | go |
089 | - | Medium | - | - | go | |
090 | - | Medium | - | - | go | |
091 | Dropbox | Fix the code snippet to print 0-9 | Easy | - | Python | go |
092 | Airbnb | - | Hard | - | - | go |
093 | Apple | - | Hard | - | - | go |
094 | - | Easy | - | - | go | |
095 | Palantir | - | Hard | - | - | go |
096 | Microsoft | - | Easy | - | - | go |
097 | Stripe | - | Medium | - | - | go |
098 | Coursera | - | Easy | - | - | go |
099 | Microsoft | - | Medium | - | - | go |
100 | - | Easy | - | - | go | |
101 | Alibaba | - | Easy | - | - | go |
102 | Lyft | - | Medium | - | - | go |
103 | Square | - | Medium | - | - | go |
104 | - | Easy | - | - | go | |
105 | - | Easy | - | - | go | |
106 | - | Medium | - | - | go | |
107 | Microsoft | - | Easy | - | - | go |
108 | - | Easy | - | - | go | |
109 | Cisco | - | Medium | - | - | go |
110 | - | Medium | - | - | go | |
111 | - | Hard | - | - | go | |
112 | - | Hard | - | - | go | |
113 | - | Medium | - | - | go | |
114 | - | Hard | - | - | go | |
115 | - | Hard | - | - | go | |
116 | Jane Street | - | Medium | - | - | go |
117 | - | Easy | - | - | go | |
118 | - | Easy | - | - | go | |
119 | - | Medium | - | - | go | |
120 | Microsoft | - | Medium | - | - | go |
121 | - | Hard | - | - | go | |
122 | Zillow | - | Medium | - | - | go |
123 | - | Hard | - | - | go | |
124 | Microsoft | - | Easy | - | - | go |
125 | - | Easy | - | - | go | |
126 | Write a function that rotates a list by k elements. | Medium | - | C++ | go | |
127 | Microsoft | Given two linked lists in this format, return their sum in the same linked list format. | Easy | - | C++ | go |
128 | None | - | Medium | - | - | go |
129 | None | - | Medium | - | - | go |
130 | - | Medium | - | - | go | |
131 | Snapchat | - | Medium | - | - | go |
132 | Riot Games | - | Easy | - | - | go |
133 | Amazon | - | Medium | - | - | go |
134 | - | Easy | - | - | go | |
135 | Apple | - | Easy | - | - | go |
136 | - | Medium | - | - | go | |
137 | Amazon | - | Medium | - | - | go |
138 | - | Hard | - | - | go | |
139 | - | Medium | - | - | go | |
140 | - | Medium | - | - | go | |
141 | Microsoft | - | Hard | - | - | go |
142 | - | Hard | - | - | go | |
143 | Amazon | - | Medium | - | - | go |
144 | - | Medium | - | - | go | |
145 | - | Easy | - | - | go | |
146 | BufferBox | - | Medium | - | - | go |
147 | None | - | Hard | - | - | go |
148 | Apple | - | Medium | - | - | go |
149 | Goldman Sachs | - | Hard | - | - | go |
150 | - | Hard | - | - | go | |
151 | None | - | Medium | - | - | go |
152 | Triplebyte | - | Medium | - | - | go |
153 | None | - | Hard | - | - | go |
154 | Amazon | - | Easy | - | - | go |
155 | MongoDB | - | Medium | - | - | go |
156 | - | Medium | - | - | go | |
157 | Amazon | - | Easy | - | - | go |
158 | Slack | - | Medium | - | - | go |
159 | Given a string, return the first recurring character in it, or null if there is no recurring character. | Easy | - | C++ | go | |
160 | Uber | - | Hard | - | - | go |
161 | - | Easy | - | - | go | |
162 | Square | - | Medium | - | - | go |
163 | Jane Street | - | Hard | - | - | go |
164 | - | Medium | - | - | go | |
165 | - | Medium | - | - | go | |
166 | Uber | - | Medium | - | - | go |
167 | Airbnb | - | Hard | - | - | go |
168 | - | Medium | - | - | go | |
169 | - | Medium | - | - | go | |
170 | - | Medium | - | - | go | |
171 | Amazon | - | Easy | - | - | go |
172 | Dropbox | - | Medium | - | - | go |
173 | Stripe | - | Easy | - | - | go |
174 | Microsoft | - | Medium | - | - | go |
175 | - | Easy | - | - | go | |
176 | Bloomberg | - | Easy | - | - | go |
177 | Airbnb | - | Easy | - | - | go |
178 | Two Sigma | Find the expected values of 5->6 and 5->5 dice games. | Hard | - | C++ | go |
179 | - | Medium | - | - | go | |
180 | Given a stack of N elements, interleave the first half of the stack with the second half reversed using only one other queue. This should be done in-place. | Medium | - | C++ | go | |
181 | - | Hard | - | - | go | |
182 | - | Medium | - | - | go | |
183 | Twitch | - | Hard | - | - | go |
184 | Amazon | - | Easy | - | - | go |
185 | - | Easy | - | - | go | |
186 | Microsoft | - | Hard | - | - | go |
187 | - | Easy | - | - | go | |
188 | - | Medium | - | - | go | |
189 | Given an array of elements, return the length of the longest subarray where all its elements are distinct. | Easy | - | C++ | go | |
190 | Given a circular array, compute its maximum subarray sum in O(n) time. A subarray can be empty, and in this case the sum is 0. | Medium | - | C++ | go | |
191 | Stripe | - | Easy | - | - | go |
192 | - | Medium | - | - | go | |
193 | Affirm | - | Hard | - | - | go |
194 | - | Easy | - | - | go | |
195 | - | Hard | - | - | go | |
196 | Apple | - | Easy | - | - | go |
197 | Amazon | - | Easy | - | - | go |
198 | - | Medium | - | - | go | |
199 | - | Hard | - | - | go | |
200 | Microsoft | - | Hard | - | - | go |
201 | - | Easy | - | - | go | |
202 | Palantir | - | Easy | - | - | go |
203 | Uber | - | Medium | - | - | go |
204 | Amazon | - | Easy | - | - | go |
205 | IBM | - | Easy | - | - | go |
206 | Given an array and a permutation, apply the permutation to the array. | Easy | - | C++ | go | |
207 | Dropbox | - | Medium | - | - | go |
208 | - | Medium | - | - | go | |
209 | YouTube | - | Hard | - | - | go |
210 | Apple | - | Easy | - | - | go |
211 | Microsoft | - | Medium | - | - | go |
212 | Dropbox | - | Easy | - | - | go |
213 | Snapchat | - | Medium | - | - | go |
214 | Stripe | Given an integer n, return the length of the longest consecutive run of 1s in its binary representation. | Easy | - | C++ | go |
215 | Yelp | - | Medium | - | - | go |
216 | - | Medium | - | - | go | |
217 | Oracle | - | Hard | - | - | go |
218 | Yahoo | - | Medium | - | - | go |
219 | Salesforce | - | Hard | - | - | go |
220 | Square | - | Medium | - | - | go |
221 | Zillow | - | Easy | - | - | go |
222 | Quora | - | Medium | - | - | go |
223 | Palantir | - | Hard | - | - | go |
224 | Amazon | - | Easy | - | - | go |
225 | Bloomberg | - | Easy | - | - | go |
226 | Airbnb | - | Hard | - | - | go |
227 | - | Easy | - | - | go | |
228 | - | Medium | - | - | go | |
229 | Flipkart | - | Medium | - | - | go |
230 | Goldman Sachs | - | Medium | - | - | go |
231 | IBM | - | Easy | - | - | go |
232 | - | Easy | - | - | go | |
233 | Apple | Implement the function fib(n), which returns the nth number in the Fibonacci sequence, using only O(1) space. | Easy | - | C++ | go |
234 | Microsoft | - | Hard | - | - | go |
235 | - | Hard | - | - | go | |
236 | Nvidia | - | Medium | - | - | go |
237 | Amazon | - | Easy | - | - | go |
238 | MIT | - | Hard | - | - | go |
239 | Uber | - | Medium | - | - | go |
240 | Spotify | - | Hard | - | - | go |
241 | Palantir | - | Easy | - | - | go |
242 | - | Hard | - | - | go | |
243 | Etsy | - | Medium | - | - | go |
244 | Square | - | Easy | - | - | go |
245 | Yelp | - | Medium | - | - | go |
246 | Dropbox | - | Medium | - | - | go |
247 | PayPal | - | Easy | - | - | go |
248 | Nvidia | - | Hard | - | - | go |
249 | Salesforce | - | Hard | - | - | go |
250 | - | Medium | - | - | go | |
251 | Amazon | - | Medium | - | - | go |
252 | Palantir | - | Easy | - | - | go |
253 | PayPal | - | Medium | - | - | go |
254 | Yahoo | - | Medium | - | - | go |
255 | Microsoft | - | Easy | - | - | go |
256 | Fitbit | - | Medium | - | - | go |
257 | - | Easy | - | - | go | |
258 | Morgan Stanley | - | Easy | - | - | go |
259 | Two Sigma | - | Hard | - | - | go |
260 | - | Medium | - | - | go | |
261 | Amazon | - | Easy | - | - | go |
262 | Mozilla | - | Medium | - | - | go |
263 | Nest | - | Medium | - | - | go |
264 | - | Hard | - | - | go | |
265 | Atlassian | - | Easy | - | - | go |
266 | Pivotal | - | Easy | - | - | go |
267 | Oracle | - | Hard | - | - | go |
268 | Indeed | - | Medium | - | - | go |
269 | Microsoft | - | Easy | - | - | go |
270 | - | Medium | - | - | go | |
271 | Netflix | - | Hard | - | - | go |
272 | Spotify | - | Medium | - | - | go |
273 | Apple | A fixed point in an array is an element whose value is equal to its index. Given a sorted array of distinct elements, return a fixed point, if one exists. Otherwise, return False. | Easy | - | C++ | go |
274 | - | Hard | - | - | go | |
275 | Epic | - | Medium | - | - | go |
276 | Dropbox | - | Hard | - | - | go |
277 | - | Easy | - | - | go | |
278 | Amazon | - | Easy | - | - | go |
279 | - | Easy | - | - | go | |
280 | Pandora | - | Easy | - | - | go |
281 | - | Medium | - | - | go | |
282 | Netflix | - | Easy | - | - | go |
283 | - | Easy | - | - | go | |
284 | Yext | - | Medium | - | - | go |
285 | Mailchimp | - | Medium | - | - | go |
286 | VMware | - | Hard | - | - | go |
287 | Quora | - | Medium | - | - | go |
288 | Salesforce | - | Medium | - | - | go |
289 | - | Hard | - | - | go | |
290 | - | Easy | - | - | go | |
291 | Glassdoor | - | Medium | - | - | go |
292 | - | Hard | - | - | go | |
293 | Uber | - | Hard | - | - | go |
294 | Square | - | Medium | - | - | go |
295 | Stitch Fix | - | Medium | - | - | go |
296 | Etsy | - | Hard | - | - | go |
297 | Amazon | - | Medium | - | - | go |
298 | - | Easy | - | - | go | |
299 | Samsung | - | Medium | - | - | go |
300 | Uber | - | Easy | - | - | go |
301 | Triplebyte | - | Medium | - | - | go |
302 | Uber | - | Medium | - | - | go |
303 | Microsoft | - | Easy | - | - | go |
304 | Two Sigma | - | Hard | - | - | go |
305 | Amazon | - | Easy | - | - | go |
306 | Palantir | - | Medium | - | - | go |
307 | Oracle | - | Easy | - | - | go |
308 | Quantcast | - | Hard | - | - | go |
309 | Walmart Labs | - | Medium | - | - | go |
310 | Pivotal | - | Easy | - | - | go |
311 | Sumo Logic | Given an unsorted array, in which all elements are distinct, find a "peak" element in O(log N) time. | Easy | - | C++ | go |
312 | Wayfair | - | Easy | - | - | go |
313 | Citrix | - | Hard | - | - | go |
314 | Spotify | - | Medium | - | - | go |
315 | - | Easy | - | - | go | |
316 | Snapchat | - | Medium | - | - | go |
317 | Yahoo | - | Medium | - | - | go |
318 | Apple | - | Hard | - | - | go |
319 | Airbnb | - | Hard | - | - | go |
320 | Amazon | - | Medium | - | - | go |
321 | PagerDuty | - | Easy | - | - | go |
322 | Flipkart | - | Medium | - | - | go |
323 | Dropbox | - | Medium | - | - | go |
324 | Amazon | - | Easy | - | - | go |
325 | Jane Street | - | Easy | - | - | go |
326 | Netflix | - | Hard | - | - | go |
327 | Salesforce | - | Easy | - | - | go |
328 | - | Medium | - | - | go | |
329 | Amazon | - | Hard | - | - | go |
330 | Dropbox | - | Hard | - | - | go |
331 | - | Medium | - | - | go | |
332 | Jane Street | - | Easy | - | - | go |
333 | - | Medium | - | - | go | |
334 | Write a function that plays the 24 game. | Easy | - | C++ | go | |
335 | - | Hard | - | - | go | |
336 | Microsoft | - | Medium | - | - | go |
337 | Apple | - | Hard | - | - | go |
338 | - | Medium | - | - | go | |
339 | Microsoft | - | Easy | - | - | go |
340 | - | Easy | - | - | go | |
341 | - | Easy | - | - | go | |
342 | Stripe | - | Medium | - | - | go |
343 | - | Medium | - | - | go | |
344 | Adobe | - | Hard | - | - | go |
345 | - | Medium | - | - | go | |
346 | Airbnb | - | Medium | - | - | go |
347 | Yahoo | You are given a string of length N and a parameter k. The string can be manipulated by taking one of the first k letters and moving it to the end. | Easy | - | C++ | go |
348 | Zillow | - | Easy | - | - | go |
349 | Grammarly | - | Hard | - | - | go |
350 | Uber | - | Medium | - | - | go |
351 | Quora | - | Hard | - | - | go |
352 | Palantir | - | Easy | - | - | go |
353 | Square | - | Medium | - | - | go |
354 | - | Hard | - | - | go | |
355 | Airbnb | - | Hard | - | - | go |
356 | Netflix | - | Hard | - | - | go |
357 | - | Hard | - | - | go | |
358 | Dropbox | - | Hard | - | - | go |
359 | Slack | - | Easy | - | - | go |
360 | Spotify | - | Medium | - | - | go |
361 | - | Medium | - | - | go | |
362 | - | Easy | - | - | go | |
363 | Squarespace | - | Medium | - | - | go |
364 | - | Medium | - | - | go | |
365 | - | Hard | - | - | go | |
366 | Flexport | - | Medium | - | - | go |
367 | Two Sigma | - | Medium | - | - | go |
368 | - | Hard | - | - | go | |
369 | Two Sigma | - | Medium | - | - | go |
370 | Postmates | - | Easy | - | - | go |
371 | - | Hard | - | - | go | |
372 | Amazon | Write a function that takes a natural number as input and returns the number of digits the input has. Don't use any loops. | Easy | - | C++ | go |
373 | - | Hard | - | - | go | |
374 | Amazon | - | Hard | - | - | go |
375 | - | Medium | - | - | go | |
376 | - | Easy | - | - | go | |
377 | Microsoft | - | Hard | - | - | go |
378 | Coinbase | - | Medium | - | - | go |
379 | Microsoft | Given a string, generate all possible subsequences of the string. | Easy | - | C++ | go |
380 | Nextdoor | - | Medium | - | - | go |
381 | Paypal | - | Easy | - | - | go |
382 | - | Easy | - | - | go | |
383 | Gusto | - | Medium | - | - | go |
384 | WeWork | - | Hard | - | - | go |
385 | Apple | - | Medium | - | - | go |
386 | - | Easy | - | - | go | |
387 | Amazon | - | Medium | - | - | go |
388 | Airtable | - | Medium | - | - | go |
389 | - | Hard | - | - | go | |
390 | Two Sigma | - | Medium | - | - | go |
391 | - | Hard | - | - | go | |
392 | - | Hard | - | - | go | |
393 | Airbnb | - | Medium | - | - | go |
394 | Uber | Given a binary tree and an integer k, return whether there exists a root-to-leaf path that sums up to k. | Easy | - | C++ | go |
395 | Robinhood | - | Medium | - | - | go |
396 | - | Hard | - | - | go | |
397 | Microsoft | - | Medium | - | - | go |
398 | Amazon | - | Medium | - | - | go |
399 | - | Hard | - | - | go |