algorithms icon indicating copy to clipboard operation
algorithms copied to clipboard

Solved algorithms and data structures problems in many languages

Data Structure and Algorithmic Problems solved in many languages

Join the chat at https://gitter.im/marcosfede/algorithms

This repository is inspired by keon's solved problems in Python 3. I wanted to compare solutions across different languages and learn them in the process. Solutions may be my own, or taken from the internet.

Click on the icons to search by language

rust go python javascript haskell julia elixir scala ruby cpp

List of problems

Events

Google Code Jam

  • [x] googlecodejam
    • [x] 2017
      • [x] Oversized Pancake Flipper
      • [x] Tidy Numbers
      • [x] Fashion Show
    • [x] 2018
      • [x] Bathroom Stalls
      • [x] Number Guessing
      • [x] Senate Evacuation
      • [x] Cruise Control
      • [x] Cube UFO
      • [x] Go Gopher
      • [x] Saving The Universe Again
      • [x] Trouble Sort
      • [x] Waffle Choppers
      • [x] Lollipop Shop
      • [x] Rounding Error
    • [x] 2019
      • [x] Cryptopangrams
      • [x] Dat Bae
      • [x] Foregone Solution
      • [x] You Can Go Your Own Way

Advent of Code

  • [x] adventofcode
    • [ ] 2018

      • [x] 1
      • [x] 2
      • [x] 3
      • [x] 4
      • [x] 5
      • [x] 6
      • [x] 7
      • [x] 8
      • [x] 9
      • [x] 10
      • [x] 11
      • [x] 12
      • [x] 13
      • [x] 14
      • [x] 15
      • [x] 16
      • [x] 17
      • [x] 18
      • [x] 19
      • [x] 20
      • [x] 21
      • [x] 22
      • [x] 23
      • [ ] 24
      • [ ] 25
    • [x] 2019

      • [x] d1
      • [x] d2
      • [x] d3
      • [x] d4
      • [x] d5
      • [x] d6
      • [x] d7
      • [x] d8

Data Structures

  • [x] array

    • [x] circular_counter
    • [x] flatten
    • [x] garage
    • [x] golf_bot
    • [x] longest_non_repeat
    • [x] merge_intervals
    • [x] missing_ranges
    • [x] plus_one
    • [x] rotate_array
    • [x] summary_ranges
    • [x] three_sum
    • [x] two_sum
  • [ ] backtrack

    • [x] anagram
    • [x] array_sum_combinations
    • [x] combination_sum
    • [x] expression_add_operators
    • [x] factor_combinations
    • [ ] generate_abbreviations
    • [ ] generate_parenthesis
    • [ ] letter_combination
    • [ ] palindrome_partitioning
    • [ ] pattern_match
    • [ ] permute
    • [ ] permute_unique
    • [ ] subsets
    • [ ] subsets_unique
  • [ ] bfs

    • [x] puzzle_game
    • [ ] shortest_distance_from_all_buildings
    • [ ] word_ladder
  • [ ] bit

    • [ ] bytes_int_conversion
    • [ ] count_ones
    • [ ] find_missing_number
    • [ ] power_of_two
    • [ ] reverse_bits
    • [ ] single_number2
    • [ ] single_number
    • [ ] subsets
    • [ ] add_without_operator
  • [ ] calculator

    • [ ] math_parser
  • [ ] dfs

    • [ ] all_factors
    • [x] count_islands
    • [ ] pacific_atlantic
    • [ ] sudoku_solver
    • [ ] walls_and_gates
  • [ ] dp

    • [ ] buy_sell_stock
    • [ ] climbing_stairs
    • [ ] coin_change
    • [ ] combination_sum
    • [ ] egg_drop
    • [ ] house_robber
    • [ ] job_scheduling
    • [ ] knapsack
    • [ ] longest_increasing
    • [ ] matrix_chain_order
    • [ ] max_product_subarray
    • [ ] max_subarray
    • [ ] min_cost_path
    • [ ] num_decodings
    • [ ] regex_matching
    • [ ] rod_cut
    • [ ] word_break
  • [ ] graph

    • [ ] strongly_connected
    • [ ] clone_graph
    • [ ] cycle_detection
    • [ ] find_all_cliques
    • [ ] find_path
    • [ ] graph
    • [ ] markov_chain
    • [ ] minimum_spanning_tree
    • [ ] satisfiability
    • [ ] tarjan
    • [ ] traversal
  • [ ] heap

    • [ ] merge_sorted_k_lists
    • [ ] skyline
    • [ ] sliding_window_max
  • [ ] linkedlist

    • [ ] add_two_numbers
    • [ ] copy_random_pointer
    • [ ] delete_node
    • [ ] first_cyclic_node
    • [x] is_cyclic
    • [ ] is_palindrome
    • [ ] kth_to_last
    • [ ] linkedlist
    • [ ] remove_duplicates
    • [ ] reverse
    • [ ] rotate_list
    • [ ] swap_in_pairs
  • [ ] map

    • [ ] hashtable
    • [ ] longest_common_subsequence
    • [ ] randomized_set
    • [ ] valid_sudoku
  • [ ] maths

    • [ ] base_conversion
    • [ ] extended_gcd
    • [ ] gcd/lcm
    • [ ] generate_strobogrammtic
    • [ ] is_strobogrammatic
    • [ ] next_perfect_square
    • [ ] nth_digit
    • [ ] prime_test
    • [ ] primes_sieve_of_eratosthenes
    • [ ] pythagoras
    • [ ] rabin_miller
    • [ ] rsa
    • [ ] sqrt_precision_factor
  • [ ] matrix

    • [ ] bomb_enemy
    • [ ] copy_transform
    • [ ] count_paths
    • [ ] matrix_rotation.txt
    • [ ] rotate_image
    • [ ] search_in_sorted_matrix
    • [ ] sparse_dot_vector
    • [ ] sparse_mul
    • [ ] spiral_traversal
  • [ ] queues

    • [ ] max_sliding_window
    • [ ] moving_average
    • [ ] queue
    • [ ] reconstruct_queue
    • [ ] zigzagiterator
  • [ ] search

    • [ ] binary_search
    • [ ] first_occurance
    • [ ] last_occurance
  • [ ] set

    • [ ] randomized_set
    • [ ] set_covering
  • [ ] sort

    • [ ] bubble_sort
    • [ ] comb_sort
    • [ ] counting_sort
    • [ ] heap_sort
    • [ ] insertion_sort
    • [ ] meeting_rooms
    • [ ] merge_sort
    • [ ] quick_sort
    • [ ] selection_sort
    • [ ] sort_colors
    • [ ] topsort
    • [ ] wiggle_sort
  • [ ] stack

    • [ ] longest_abs_path
    • [ ] simplify_path
    • [ ] stack
    • [ ] valid_parenthesis
  • [ ] strings

    • [x] molecules_to_atoms
    • [ ] add_binary
    • [ ] breaking_bad
    • [ ] decode_string
    • [ ] encode_decode
    • [ ] group_anagrams
    • [ ] int_to_roman
    • [ ] is_palindrome
    • [ ] license_number
    • [ ] make_sentence
    • [ ] multiply_strings
    • [ ] one_edit_distance
    • [ ] rabin_karp
    • [ ] reverse_string
    • [ ] reverse_vowel
    • [ ] reverse_words
    • [ ] roman_to_int
    • [ ] word_squares
  • [ ] tree

    • [ ] binary_tree
      • [x] binary_tree
      • [x] binary_tree_paths
      • [x] deepest_left
      • [x] invert_tree
      • [x] is_balanced
      • [x] is_same_tree
      • [x] is_subtree
      • [x] is_symmetric
      • [ ] longest_consecutive_sequence
      • [ ] lowest_common_ancestor
      • [ ] max_height
      • [ ] min_height
      • [ ] path_sum
      • [ ] serialize_deserialize
      • [ ] traversal
        • [ ] inorder
        • [ ] level_order
        • [ ] zigzag
    • [ ] binary_search_tree
      • [ ] array2bst
      • [ ] binary_search_tree
      • [ ] bst_closest_value
      • [ ] BSTIterator
      • [ ] delete_node
      • [ ] is_valid_bst
      • [ ] kth_smallest
      • [ ] lowest_common_ancestor
      • [ ] unique_bst
    • [ ] red_black_tree
      • [ ] red_black_tree
    • [ ] segment_tree
      • [ ] segment_tree
    • [ ] trie
      • [ ] add_and_search
      • [ ] trie
  • [x] union-find

    • [x] count_islands

List of Designs

  • design
    • [ ] alarm_system
    • [ ] all_o_one_ds
    • [ ] excel_table
    • [ ] LRUcache
    • [ ] nearby_drivers
    • [ ] ride_sharing
    • [ ] task_runner
    • [ ] twitter_feeds

Contributing

I'd love to have contributors, all feedback is welcome! Take a look at CONTRIBUTING

Additional resources