Skip to content

daveight/ankicode-decks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Collection of Programming Challenges for AnkiCode

https://github.com/daveight/ankicode

Decks

  • Decks src code is located in the src folder
  • Compiled decks are located in the dist folder in .csv format

Build decks

Build decks with the following command: python3 build_decks.py As the result, csv files will be generated and placed into dist folder

Add new coding problems to the existing deck

  • title/<problem_name> - contains a title of a new coding problem
  • description/<problem_name> - contains a text description of a new coding problem
  • fn_names/<problem_name> - function name which will be used in the solution template
  • solutions/cpp/<problem_name> - markdown file containing C++ solution of a problem
  • solutions/python/<problem_name> - markdown file containing Python solution of a problem
  • solutions/java/<problem_name> - markdown file containing Java solution of a problem
  • solutions/js/<problem_name> - markdown file containing JavaScript solution of a problem
  • test_cases/<problem_name> - a TSV (tab-separated) file with test-cases

Programming Challenge Decks

LeetCode

Decks based on LeetCode problems https://github.com/interviewcoder/leetcode.

Name Count Link Size
Easy 50 easy.apkg 31 KB
Medium 114 medium.apkg 103 KB
Hard 44 hard.apkg 51 KB

Problems List

# Name Complexity Tags
1 ZigZag Conversion Easy String
2 Reverse Integer Easy Math
3 Palindrome Number Easy Math
4 Roman to Integer Easy Math String
5 Longest Common Prefix Easy String
6 Remove Nth Node From End of List Easy Linked List Two Pointers
7 Valid Parentheses Easy Stack String
8 Merge Two Sorted Lists Easy Linked List
9 Remove Duplicates from Sorted Array Easy Array Two Pointers
10 Remove Element Easy Array Two Pointers
11 Implement strStr() Easy Two Pointers String
12 Valid Sudoku Easy Hash Table
13 Count and Say Easy String
14 Length of Last Word Easy String
15 Plus One Easy Array Math
16 Add Binary Easy Math String
17 Climbing Stairs Easy Dynamic Programming
18 Remove Duplicates from Sorted List Easy Linked List
19 Merge Sorted Array Easy Array Two Pointers
20 Same Tree Easy Tree Depth-first Search
21 Symmetric Tree Easy Tree Depth-first Search
22 Binary Tree Level Order Traversal Easy Tree Breadth-first Search
23 Maximum Depth of Binary Tree Easy Tree Depth-first Search
24 Binary Tree Level Order Traversal II Easy Tree Breadth-first Search
25 Balanced Binary Tree Easy Tree Depth-first Search
26 Minimum Depth of Binary Tree Easy Tree Depth-first Search Breadth-first Search
27 Path Sum Easy Tree Depth-first Search
28 Pascal's Triangle Easy Array
29 Pascal's Triangle II Easy Array
30 Valid Palindrome Easy Two Pointers String
31 Intersection of Two Linked Lists Easy Linked List
32 Compare Version Numbers Easy String
33 Excel Sheet Column Title Easy Math
34 Excel Sheet Column Number Easy Math
35 Factorial Trailing Zeroes Easy Math
36 Rotate Array Easy Array
37 Remove Linked List Elements Easy Linked List
38 Count Primes Easy Hash Table Math
39 Reverse Linked List Easy Linked List
40 Contains Duplicate Easy Array Hash Table
41 Contains Duplicate II Easy Array Hash Table
42 Rectangle Area Easy Math
43 Summary Ranges Easy Array
44 Power of Two Easy Math Bit Manipulation
45 Lowest Common Ancestor of a Binary Search Tree Easy Tree
46 Valid Anagram Easy Hash Table Sort
47 Strobogrammatic Number Easy Hash Table Math
48 Meeting Rooms Easy Sort
49 First Bad Version Easy Binary Search
50 Move Zeroes Easy Array Two Pointers
51 Two Sum Medium Array Hash Table
52 Add Two Numbers Medium Linked List Math
53 Longest Substring Without Repeating Characters Medium Hash Table Two Pointers String
54 Longest Palindromic Substring Medium String
55 Container With Most Water Medium Array Two Pointers
56 Integer to Roman Medium Math String
57 3Sum Medium Array Two Pointers
58 3Sum Closest Medium Array Two Pointers
59 Letter Combinations of a Phone Number Medium Backtracking String
60 4Sum Medium Array Hash Table Two Pointers
61 Generate Parentheses Medium Backtracking String
62 Swap Nodes in Pairs Medium Linked List
63 Divide Two Integers Medium Math Binary Search
64 Next Permutation Medium Array
65 Search for a Range Medium Array Binary Search
66 Search Insert Position Medium Array Binary Search
67 Combination Sum Medium Array Backtracking
68 Combination Sum II Medium Array Backtracking
69 Multiply Strings Medium Math String
70 Permutations Medium Backtracking
71 Rotate Image Medium Array
72 Group Anagrams Medium Hash Table String
73 Pow(x, n) Medium Math Binary Search
74 Maximum Subarray Medium Divide and Conquer Array Dynamic Programming
75 Spiral Matrix Medium Array
76 Jump Game Medium Array Greedy
77 Spiral Matrix II Medium Array
78 Permutation Sequence Medium Backtracking Math
79 Rotate List Medium Linked List Two Pointers
80 Unique Paths Medium Array Dynamic Programming
81 Unique Paths II Medium Array Dynamic Programming
82 Minimum Path Sum Medium Array Dynamic Programming
83 Sqrt(x) Medium Math Binary Search
84 Simplify Path Medium Stack String
85 Set Matrix Zeroes Medium Array
86 Search a 2D Matrix Medium Array Binary Search
87 Sort Colors Medium Array Two Pointers Sort
88 Combinations Medium Backtracking
89 Subsets Medium Array Backtracking Bit Manipulation
90 Word Search Medium Array Backtracking
91 Remove Duplicates from Sorted Array II Medium Array Two Pointers
92 Search in Rotated Sorted Array II Medium Array Binary Search
93 Remove Duplicates from Sorted List II Medium Linked List
94 Partition List Medium Linked List Two Pointers
95 Gray Code Medium Backtracking
96 Subsets II Medium Array Backtracking
97 Decode Ways Medium Dynamic Programming String
98 Reverse Linked List II Medium Linked List
99 Restore IP Addresses Medium Backtracking String
100 Binary Tree Inorder Traversal Medium Tree Hash Table Stack
101 Unique Binary Search Trees II Medium Tree Dynamic Programming
102 Unique Binary Search Trees Medium Tree Dynamic Programming
103 Validate Binary Search Tree Medium Tree Depth-first Search
104 Binary Tree Zigzag Level Order Traversal Medium Tree Breadth-first Search Stack
105 Construct Binary Tree from Preorder and Inorder Traversal Medium Tree Array Depth-first Search
106 Construct Binary Tree from Inorder and Postorder Traversal Medium Tree Array Depth-first Search
107 Convert Sorted Array to Binary Search Tree Medium Tree Depth-first Search
108 Convert Sorted List to Binary Search Tree Medium Depth-first Search Linked List
109 Path Sum II Medium Tree Depth-first Search
110 Flatten Binary Tree to Linked List Medium Tree Depth-first Search
111 Triangle Medium Array Dynamic Programming
112 Best Time to Buy and Sell Stock Medium Array Dynamic Programming
113 Best Time to Buy and Sell Stock II Medium Array Greedy
114 Word Ladder Medium Breadth-first Search
115 Sum Root to Leaf Numbers Medium Tree Depth-first Search
116 Surrounded Regions Medium Breadth-first Search
117 Palindrome Partitioning Medium Backtracking
118 Single Number Medium Hash Table Bit Manipulation
119 Word Break Medium Dynamic Programming
120 Linked List Cycle Medium Linked List Two Pointers
121 Linked List Cycle II Medium Linked List Two Pointers
122 Reorder List Medium Linked List
123 Binary Tree Preorder Traversal Medium Tree Stack
124 Insertion Sort List Medium Linked List Sort
125 Sort List Medium Linked List Sort
126 Evaluate Reverse Polish Notation Medium Stack
127 Reverse Words in a String Medium String
128 Maximum Product Subarray Medium Array Dynamic Programming
129 Find Minimum in Rotated Sorted Array Medium Array Binary Search
130 Longest Substring with at most Two Distinct Characters Medium String
131 One Edit Distance Medium String
132 Find Peak Element Medium Array Binary Search
133 Missing Ranges Medium Array
134 Fraction to Recurring Decimal Medium Hash Table Math
135 Binary Search Tree Iterator Medium Tree Stack
136 Largest Number Medium Sort
137 Reverse words in a string II Medium Array
138 Binary Tree Right Side View Medium Tree Depth-first Search Breadth-first Search
139 Number of Islands Medium Depth-first Search Breadth-first Search
140 Course Schedule Medium Depth-first Search Breadth-first Search Graph Topological Sort
141 Minimum Size Subarray Sum Medium Array Two Pointers Binary Search
142 Course Schedule II Medium Depth-first Search Breadth-first Search Graph Topological Sort
143 House Robber II Medium Dynamic Programming
144 Kth Largest Element in an Array Medium Divide and Conquer Heap
145 Combination Sum III Medium Array Backtracking
146 Contains Duplicate III Medium Binary Search Tree
147 Maximal Square Medium Dynamic Programming
148 Basic Calculator Medium Stack Math
149 Majority Element II Medium Array
150 Kth Smallest Element in a BST Medium Tree Binary Search
151 Lowest Common Ancestor of a Binary Tree Medium Tree
152 Product of Array Except Self Medium Array
153 Search a 2D Matrix II Medium Divide and Conquer Binary Search
154 Flatten2DVector Medium Design
155 Meeting Rooms II Medium Heap Greedy Sort
156 Paint House Medium Dynamic Programming
157 Graph Valid Tree Medium Breadth-first Search Depth-first Search Graph Union-Find
158 Missing Number Medium Array Math Bit Manipulation
159 Integer to English Words Medium Math String
160 H-Index Medium Hash Table Sort
161 H-Index II Medium Binary Search
162 Paint Fence Medium Dynamic Programming
163 Peeking Iterator Medium Design
164 Inorder Successor in BST Medium Tree
165 Walls And Gates Medium BFS
166 Median of Two Sorted Arrays Hard Divide and Conquer Array Binary Search
167 Regular Expression Matching Hard Dynamic Programming Backtracking String
168 Merge k Sorted Lists Hard Divide and Conquer Linked List Heap
169 Substring with Concatenation of All Words Hard Hash Table Two Pointers String
170 Longest Valid Parentheses Hard Dynamic Programming String
171 Search in Rotated Sorted Array Hard Array Binary Search
172 Sudoku Solver Hard Backtracking Hash Table
173 First Missing Positive Hard Array
174 Trapping Rain Water Hard Array Stack Two Pointers
175 Wildcard Matching Hard Dynamic Programming Backtracking Greedy String
176 Jump Game II Hard Array Greedy
177 Permutations II Hard Backtracking
178 N-Queens Hard Backtracking
179 N-Queens II Hard Backtracking
180 Merge Intervals Hard Array Sort
181 Insert Interval Hard Array Sort
182 Valid Number Hard Math String
183 Text Justification Hard String
184 Edit Distance Hard Dynamic Programming String
185 Minimum Window Substring Hard Hash Table Two Pointers String
186 Largest Rectangle in Histogram Hard Array Stack
187 Maximal Rectangle Hard Array Hash Table Stack Dynamic Programming
188 Scramble String Hard Dynamic Programming String
189 Interleaving String Hard Dynamic Programming String
190 Recover Binary Search Tree Hard Tree Depth-first Search
191 Distinct Subsequences Hard Dynamic Programming String
192 Best Time to Buy and Sell Stock III Hard Array Dynamic Programming
193 Binary Tree Maximum Path Sum Hard Tree Depth-first Search
194 Word Ladder II Hard Array Backtracking Breadth-first Search String
195 Longest Consecutive Sequence Hard Array
196 Palindrome Partitioning II Hard Dynamic Programming
197 Candy Hard Greedy
198 Word Break II Hard Dynamic Programming Backtracking
199 Binary Tree Postorder Traversal Hard Tree Stack
200 Max Points on a Line Hard Hash Table Math
201 Find Minimum in Rotated Sorted Array II Hard Array Binary Search
202 Maximum Gap Hard Sort
203 Dungeon Game Hard Dynamic Programming Binary Search
204 Best Time to Buy and Sell Stock IV Hard Dynamic Programming
205 Word Search II Hard Backtracking Trie
206 The Skyline Problem Hard Divide and Conquer Heap
207 Sliding Window Maximum Hard Heap
208 Paint House Hard Dynamic Programming
209 Alien Dictionary Hard Graph Topological Sort

Elements of Programming Interviews

Decks based on the book "Elements of Programming Interviews" by Adnan Aziz, Tsung-Hsien Lee, Amin Prakash.

Name Count Link Size
Arrays 27 arrays.apkg 3.36 MB
Binary Search Trees 13 binary_search_trees.apkg 7.03 MB
Binary Trees 16 binary_trees.apkg 6.85 MB
Dynamic Programming 18 dynamic_programming.apkg 745 KB
Graphs 12 graphs.apkg 2.21 MB
Greedy Algorithms 7 greedy_algorithms.apkg 862 KB
Hash Tables 12 hash_tables.apkg 2.06 MB
Heaps 7 heaps.apkg 1.77 MB
Linked Lists 15 linked_lists.apkg 5.7 MB
Primitive Types 11 primitive_types.apkg 1.2 MB
Recursion 13 recursion.apkg 567 KB
Searching 16 searching.apkg 2.98 MB
Sorting 12 sorting.apkg 1.28 MB
Stacks & Queues 7 stacks_and_queues.apkg 839 KB
Strings 18 strings.apkg 1.31 MB

Problems List

# Name Tags
1 Jumping game. Arrays
2 Alternating Array Arrays
3 Apply Permutation. Arrays
4 Stock Buy Sell to Maximize Profit. Arrays
5 Stock Buy Sell K Times to Maximize Profit. Arrays
6 Stock Buy Sell Twice to Maximize Profit. Arrays
7 The Dutch National Flag Problem Arrays
8 Even odd array Arrays
9 Increment an arbitrary-precision integer Arrays
10 Multiply two arbitrary-precision integers Arrays
11 The Sudoku checker problem Arrays
12 Compute the longest contiguous increasing subarray Arrays
13 Find the longest subarray whose sum <= k Arrays
14 Rotate a 2D array Arrays
15 Compute the maximum product of all entries but one Arrays
16 Find the maximum square 2D subarray Arrays
17 Find the maximum 2D subarray Arrays
18 Trapping water Arrays
19 Compute the maximum subarray sum in a circular array Arrays
20 Compute the next permutation Arrays
21 Compute rows in Pascal's Triangle Arrays
22 Enumerate all primes to n Arrays
23 Identify positions attacked by rooks Arrays
24 Rotate an array Arrays
25 Smallest nonconstructible value Arrays
26 Delete duplicates from a sorted array Arrays
27 Compute the spiral ordering of a 2D array Arrays
28 Square Root Range. Binary search trees
29 Reconstruct a BST from traversal data Binary search trees
30 Build a minimum height bst from a sorted array Binary search trees
31 Merge two BSTs Binary search trees
32 Convert a BST to a sorted doubly linked list Binary search trees
33 Test if three BST nodes are totally ordered Binary search trees
34 Test if a binary tree satisfies the BST property Binary search trees
35 Find the k largest elements in a BST Binary search trees
36 Compute the LCA in a BST Binary search trees
37 Find the closest entries in three sorted arrays Binary search trees
38 The range lookup problem Binary search trees
39 Find the first key greater than a given value in a BST Binary search trees
40 Search a sorted array for first occurrence of k Binary search trees
41 Compute the k-th node in an inorder traversal Binary trees
42 Test if a binary tree is height-balanced Binary trees
43 Test if a binary tree is symmetric Binary trees
44 Compute the kth node in an inorder traversal Binary trees
45 Compute the lowest common ancestor in a binary tree Binary trees
46 Find a root to leaf path with specified sum Binary trees
47 Compute the successor Binary trees
48 Sum the root-to-leaf paths in a binary tree Binary trees
49 Form a linked list from the leaves of a binary tree Binary trees
50 Compute the exterior of a binary tree Binary trees
51 Reconstruct a binary tree from traversal data Binary trees
52 Implement an inorder traversal without recursion Binary trees
53 Implement a postorder traversal without recursion Binary trees
54 Implement a preorder traversal without recursion Binary trees
55 Compute the right sibling tree Binary trees
56 Implement an inorder traversal with O(1) space Binary trees
57 Binomial Coefficients. Dynamic programming
58 Checkerboard problem Dynamic programming
59 Drawing the Skyline Dynamic programming
60 fibonacci Dynamic programming
61 The bedbathandbeyond.com problem Dynamic programming
62 Search for a sequence in a 2D array Dynamic programming
63 The knapsack problem Dynamic programming
64 Compute the Levenshtein distance Dynamic programming
65 Find the longest nondecreasing subsequence Dynamic programming
66 Matrix Chain Multiplication Dynamic programming
67 Bootcamp: Dynamic Programming Dynamic programming
68 Find the minimum weight path in a triangle Dynamic programming
69 Count the number of score combinations Dynamic programming
70 Count the number of ways to traverse a 2D array Dynamic programming
71 Count the number of moves to climb stairs Dynamic programming
72 Pick up coins for maximum gain Dynamic programming
73 The pretty printing problem Dynamic programming
74 Count of balanced 0–1 matrices Dynamic programming
75 Arbitrage. Graphs
76 Deadlock Detection Graphs
77 Find all paths in a graph using Breadth First Search Graphs
78 Making wired connections Graphs
79 Compute enclosed regions Graphs
80 Team photo day - 2 Graphs
81 Paint a Boolean matrix Graphs
82 Road network Graphs
83 Kosaraju's algorithm Graphs
84 Search a maze Graphs
85 Transform one string to another Graphs
86 Topological Sorting Graphs
87 Synthesize an Expression Greedy algorithms
88 Compute the largest rectangle under the skyline Greedy algorithms
89 Find the majority element Greedy algorithms
90 Compute the maximum water trapped by a pair of vertical lines Greedy algorithms
91 The interval covering problem Greedy algorithms
92 Schedule to minimize waiting time Greedy algorithms
93 Compute an optimum assignment of tasks Greedy algorithms
94 The 3-sum problem Greedy algorithms
95 The interval covering problem Greedy algorithms
96 Anagrams. Hash tables
97 Collatz Conjecture. Hash tables
98 Is an anonymous letter constructible? Hash tables
99 Test for palindromic permutations Hash tables
100 Find the line through the most points Hash tables
101 Find the length of a longest contained interval Hash tables
102 Find the longest subarray with distinct entries Hash tables
103 Find the nearest repeated entries in an array Hash tables
104 The heavy hitter problem Hash tables
105 Find smallest subarray sequentially covering all values Hash tables
106 Find the smallest subarray covering all values Hash tables
107 Compute all string decompositions Hash tables
108 Reward Distribution. Heaps
109 Compute the k closest stars Heaps
110 Compute the k largest elements in a max-heap Heaps
111 Compute the median of online data Heaps
112 Sort an almost-sorted array Heaps
113 Sort an increasing-decreasing array Heaps
114 Merge two sorted arrays Heaps
115 Delete a node after index i in a linked-list Linked lists
116 Remove the Kth last element from a list Linked lists
117 Delete a node from a singly linked list Linked lists
118 Test for overlapping lists. Lists are cycle-free. Linked lists
119 Implement even-odd merge Linked lists
120 Insert a node into a linked-list Linked lists
121 Add list-based integers Linked lists
122 Test for cyclicity Linked lists
123 Test whether a singly linked list is palindromic Linked lists
124 Implement cyclic right shift for singly linked lists Linked lists
125 Remove duplicates from a sorted list Linked lists
126 Reverse a single sublist Linked lists
127 Bootcamp: Linked Lists Linked lists
128 Merge two sorted lists Linked lists
129 Implement list zipping Linked lists
130 Find the closest integer with same weight. Primitive types
131 Count Set Bits. Primitive types
132 Check if a decimal integer is a palindrome Primitive types
133 Computing the parity of a word Primitive types
134 Compute x^y Primitive types
135 Compute x/y Primitive types
136 Compute x * y without arithmetical operators Primitive types
137 Rectangle intersection Primitive types
138 Reverse bits Primitive types
139 Reverse digits Primitive types
140 Swap bits Primitive types
141 Generate all subsets of size k. Recursion
142 Defective Jugs Recursion
143 Generate strings of matched parens Recursion
144 Generate palindromic decompositions Recursion
145 Generate binary trees Recursion
146 Equal subset sum partition Recursion
147 Greatest common divisor Recursion
148 Compute a Gray code Recursion
149 The Towers of Hanoi problem Recursion
150 Determine the critical height Recursion
151 Generate all nonattacking placements of n-Queens Recursion
152 Generate permutations Recursion
153 Generate the power set Recursion
154 Missing IP Address. Searching
155 Binary Search Searching
156 Find an element that appears only once Searching
157 Find the duplicate and missing elements Searching
158 Find the first missing positive entry Searching
159 H-Index Searching
160 Find first and last positions in array Searching
161 Compute the integer square root Searching
162 Find the kth largest element - large n, small k Searching
163 Search in two sorted arrays Searching
164 Find the kth largest element Searching
165 Compute the real square root Searching
166 Find the min and max simultaneously Searching
167 Search in a 2D sorted array Searching
168 Search a cyclically sorted array Searching
169 Search a sorted array of unknown length Searching
170 Bubble sort Sorting
171 Calendar Rendering. Sorting
172 Count Inversions Sorting
173 Compute a salary threshold Sorting
174 Heap sort Sorting
175 Insertion sort Sorting
176 Compute the intersection of two sorted arrays Sorting
177 Merging intervals Sorting
178 Compute the union of intervals Sorting
179 Find K-th largest element in int array Sorting
180 Remove first-name duplicates Sorting
181 Implement a fast sorting algorithm for lists Sorting
182 Merge two sorted arrays Sorting
183 Normalize Pathnames Stacks and queues
184 Evaluate RPN expressions Stacks and queues
185 Test a string over {},(),[] for well-formedness Stacks and queues
186 Compute the longest substring with matching parens Stacks and queues
187 Compute the maximum of a sliding window Stacks and queues
188 Compute buildings with a sunset view Stacks and queues
189 Compute binary tree nodes in order of increasing depth Stacks and queues
190 Number Base Convertion. Strings
191 Implement Huffman coding Strings
192 Test palindromicity Strings
193 Justify text Strings
194 Longest common substring Strings
195 The look-and-say problem Strings
196 Least String Rotation Strings
197 Compute all mnemonics for a phone number Strings
198 Search pattern in a string Strings
199 Implement regular expression matching Strings
200 Replace and remove Strings
201 Reverse all the words in a sentence Strings
202 Convert from Roman to decimal Strings
203 Implement run-length encoding Strings
204 Write a string sinusoidally Strings
205 Compute the spreadsheet column encoding Strings
206 Find the first occurrence of a substring Strings
207 Compute all valid IP addresses Strings