Skip to content

r1cc4rdo/daily_coding_problem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Daily coding problem

These are my solutions to https://dailycodingproblem.com, a great resource to practice coding interviews.

I have copied problem definitions and examples verbatim from the one I received, but they might occasionally differ from yours when questions have been updated to improve clarity or provide additional tests. Notes added after examples are comments of mine.

Problems

Each problem comes with a description, a unit tests' battery and a solution.

Just looking for a FizzBuzz implementation? Find a few here!

# Description Problem Solution
01 Interleave the elements of a stack using a queue problem solution
02 Product of every other number in an array problem solution
03 Serialize a tree into a string and back problem solution
04 Find the first missing positive integer problem solution
05 Implement Lisp's car and cdr given cons problem solution
06 Implement a XOR linked list problem solution
07 Count the number of decodings for a message problem solution
08 Count the number of unival subtrees problem solution
09 Largest sum of non-adjacent numbers problem solution
10 Call a function after n milliseconds problem solution
11 Implement an autocomplete system problem solution
12 Count the ways to climb a staircase problem solution
13 Longest substring made of k distinct characters problem solution
14 Monte-Carlo estimate of Pi problem solution
15 Pick a random element from a stream problem solution
16 Implement an purchase orders' log problem solution
17 Longest path in a filesystem problem solution
18 Max of each sub-array of length k problem solution
19 House coloring problem problem solution
20 Find intersection between single linked lists problem solution
21 Number of classrooms required given schedule problem solution
22 Split a string of words into parts problem solution
23 Solve a maze problem solution
24 Implement locking in a binary tree problem solution
25 Implement regular expression matcher problem solution
26 Remove the kth element from a linked list problem solution
27 Is a string of brackets well-formed? problem solution
28 Write an algorithm to justify text problem solution
29 Run-length encoding and decoding problem solution
30 Water trapped in an elevation map problem solution
31 Compute the edit distance between two strings problem solution
32 Possibility of arbitration in currency exchange problem solution
33 Compute the running median of a sequence of numbers problem solution
34 Fewest characters to make a palindrome problem solution
35 Segregate the values of an array problem solution
36 Find the second largest node in the tree problem solution
37 Generate the power set of a set problem solution
38 Solve the N-queens problem problem solution
39 Implement Conway's Game of Life problem solution
40 Find the non-duplicated integer problem solution
41 Itinerary from flights' list problem solution
42 Subset of an array that adds up to k problem solution
43 Implement a stack with a max() operation problem solution
44 Determine how "out of order" an array A is problem solution
45 Implement rand5() given rand7() problem solution
46 Find the longest contiguous palindrome problem solution
47 Max profit from a stock time-series problem solution
48 Reconstruct tree from pre-order and in-order traversals problem solution
49 Find the maximum sum of any contiguous subarray problem solution
50 Compute an arithmetic expression tree problem solution

How to contribute

Pull requests warmly welcomed if you spot issues with any of my solutions!

You can also contribute additional unit tests for interesting untested scenarios.

Running tests

To run all the unit tests for the provided solutions, use the run_tests.py scripts inside the problems and legacy directories.

Python 2.7 compatible versions

Python 2.7 compatible versions are available under the legacy directory.