{"id":13936380,"url":"https://github.com/chiphuyen/coding-exercises","last_synced_at":"2025-04-05T07:05:40.993Z","repository":{"id":59673346,"uuid":"111276232","full_name":"chiphuyen/coding-exercises","owner":"chiphuyen","description":"My implementation of useful data structures, algorithms,  as well as my solutions to programming puzzles. ","archived":false,"fork":false,"pushed_at":"2019-11-21T04:14:33.000Z","size":477,"stargazers_count":497,"open_issues_count":1,"forks_count":194,"subscribers_count":38,"default_branch":"master","last_synced_at":"2025-03-29T06:06:53.425Z","etag":null,"topics":["coding-challenge","coding-exercises","coding-interviews","training-materials"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chiphuyen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-19T08:06:58.000Z","updated_at":"2025-03-13T22:56:45.000Z","dependencies_parsed_at":"2022-09-19T19:51:54.611Z","dependency_job_id":null,"html_url":"https://github.com/chiphuyen/coding-exercises","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiphuyen%2Fcoding-exercises","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiphuyen%2Fcoding-exercises/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiphuyen%2Fcoding-exercises/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiphuyen%2Fcoding-exercises/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chiphuyen","download_url":"https://codeload.github.com/chiphuyen/coding-exercises/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247299832,"owners_count":20916190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coding-challenge","coding-exercises","coding-interviews","training-materials"],"created_at":"2024-08-07T23:02:36.964Z","updated_at":"2025-04-05T07:05:40.955Z","avatar_url":"https://github.com/chiphuyen.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"This repository contains my implementation of useful data structures, algorithms, \ngames, as well as my solutions to programming puzzles. \n\nEach item is marked with a difficulty level.\n1 - easy\n2 - medium\n3 - hard\n\nIf a file name starts with 'lc', it's a problem from leetcode.com\n\nWritten in python3. Thanks Danijar Hafner (@danijar) for the inspiration.\n\nData structures\n---------------\n\n### Linked lists\n\n- [x] List class (linked_list.py) - 1\n- [ ] Remove duplicates (linked_list_algos.py)\n- [ ] Find nth last element (linked_list_algos.py)\n- [ ] Remove node given only its object (linked_list_algos.py)\n- [ ] Sum linked lists with one digit per node (linked_list_algos.py)\n- [ ] Find beginning of circle (linked_list_algos.py)\n\n### Trees\n\n- [x] Binary heap class (binary_heap.py) - 2\n- [ ] Binary tree class (binary_tree.py) - 1\n- [x] Binary search tree class that allows duplicate values (binary_search_tree.py) - 2\n\t  \n\t  BST class inherits binary tree class\n\t  \n- [ ] Red black tree class (red_black_tree.py)\n- [ ] B+ tree class (b_tree.py) - 3\n- [x] Trie class that allows word removal (trie.py) - 2\n- [x] Check if a binary tree is a binary search tree (binary_tree_algos.py) - 2\n- [ ] Check if a binary tree is balanced (binary_tree_algos.py)\n- [ ] Find first common ancestor of two nodes in a binary tree (binary_tree_algos.py)\n- [ ] Get all nodes of depth n in a binary tree (binary_tree_algos.py)\n- [ ] Given two large trees, check if the first is a subtree of the second (binary_tree_algos.py)\n- [ ] Find all sub paths in a binary tree that sum up to x (binary_tree_algos.py)\n- [ ] Create a balanced binary search tree from a sorted array (bst_algos.py)\n\n### Graphs\n\n- [ ] Undirected graph class\n- [ ] Directed graph class\n- [ ] Breadth first search (search.py)\n- [ ] Depth first search (search.py)\n- [ ] A-star (search.py)\n\n### Stacks and queues\n\n- [ ] Queue class (queue.py)\n- [x] Heap priority queue (priority_queue.py) - 1\n- [ ] Stack class (stack.py)\n- [ ] Stack that finds min in O(1) (min_stack.py)\n- [ ] Solve Hanoi towers using stacks (stack_algos.py)\n- [ ] Sort stack using only push, pop, peek and empty (stack_algos.py)\n- [ ] Build a queue using two stacks (stack_algos.py)\n\nAlgorithms\n----------\n\n### Sorting\n- [x] Insertion sort (sort.py) - 1\n- [x] Selection sort (sort.py) - 1\n- [x] Merge sort (sort.py) - 2\n- [x] Heap sort (sort.py) - 2\n- [x] Quick sort (sort.py) - 2\n- [x] Counting sort (sort.py) - 2\n- [x] Radix sort (sort.py) - 2\n- [x] Bucket sort (sort.py) - 2\n\n### Dynamic Programming\n- [ ] Computing a Fibonacci sequence\n- [ ] Find the longest common subsequence between two strings\n\n### Recursion\n\n- [ ] Find all permutations of a string\n- [ ] Find all subsets of a set\n- [ ] Find all proper combinations of n parentheses\n- [ ] Bucket fill\n- [ ] Check if it's possible to make a change with a set of coins\n- [ ] Check if it's possible to weight two objects with a set of weights\n- [ ] Eight queen\n\nProgramming Puzzles\n-------------------\n\n### String Manipulation\n- [x] Check if two strings are anagrams in O(n + m) time (anagrams.py) - 1\n- [x] Find the longest palindromic substring in O(n^2) time (lc_longest_palindrome.py) - 2\n- [x] Check if a string has balanced delimiters in O(n) time (delim_balanced.py) - 2\n- [x] Reverse words while maintaining spaces and tabs in O(n) time (reverse_words.py) - 2\n- [x] Longest substring without repeating characters in O(n) time (lc_longest_nonrepeat_substring.py) - 2\n- [x] Longest contiguous substring of 2 distinct characters in O(n) time (substring_two_chars.py) - 2\n- [ ] Remove duplicate chars in a string\n- [ ] Encode and decode Caesar cipher (caesar.py)\n- [ ] Check if a string is a rotation of another\n\n### Mathematical\n- [x] Reverse integers (lc_reverse_int.py) - 1\n- [x] Sieve of Eratosthenes (sieve_prime.py) - 1\n- [x] Two sum in O(n) time (lc_two_sum.py) - 1\n\t  \n\t  Given an array of integers, return indices of the two numbers \n\t  such that they add up to a specific target.\n\n- [x] Year with maximum population (year_max_pop.py) - 1\n\t  \n\t  Given a list of people with their years of birth and death, \n\t  find the year with max population\n\n- [x] FizzBuzz (fizzbuzz.py) - 1\n- [x] ZigZag conversion (lc_zigzag_convert.py) - 2\n- [x] Find sum of all subarrays of an array (subarray_sum.py) - 2\n- [x] Add two numbers, each represented by a reverse linked list (lc_add_number_reverse.py) - 2\n- [x] Find the median of two sorted arrays in O(log(m+n)) time (lc_median_arrays.py) - 3\n- [ ] Find nth smallest number that can be created using a list of prime factors\n- [ ] Count occurences of given digit in all numbers up to n\n- [ ] Rotate N x N matrix in place\n\n### Games\n- [x] Game of ghost (ghost.py) - 3\n\t  \n\t  Ghost is a word game in which players take turns adding letters to a\n\t  growing word fragment, trying not to be the one to complete a valid word.\n\n\t  This implementation uses minimax with alpha-beta pruning to make sure the computer always wins.\n\t  It uses a Trie to keep track of the dictionary.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchiphuyen%2Fcoding-exercises","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchiphuyen%2Fcoding-exercises","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchiphuyen%2Fcoding-exercises/lists"}