|
| 1 | +A list of problems found at [reddit](https://www.reddit.com/r/cscareerquestions/comments/20ahfq/heres_a_pretty_big_list_of_programming_interview/) that could be useful if you're training for an interview, or if you just want to improve yourself as a programmer. |
| 2 | + |
| 3 | +> This list was copied from [@delete's list](https://github.com/delete/lab/tree/master/interview_questions) |
| 4 | +
|
| 5 | +## General |
| 6 | +- [ ] Find pairs in an integer array whose sum is equal to 10 (bonus: do it in linear time) |
| 7 | + |
| 8 | +- [ ] Given 2 integer arrays, determine of the 2nd array is a rotated version of the 1st array. Ex. Original Array A={1,2,3,5,6,7,8} Rotated Array B={5,6,7,8,1,2,3} |
| 9 | + |
| 10 | +- [ ] Write fibbonaci iteratively and recursively (bonus: use dynamic programming) |
| 11 | + |
| 12 | +- [ ] Find the only element in an array that only occurs once. |
| 13 | + |
| 14 | +- [ ] Find the common elements of 2 int arrays |
| 15 | + |
| 16 | +- [ ] Implement binary search of a sorted array of integers |
| 17 | + |
| 18 | +- [ ] Implement binary search in a rotated array (ex. {5,6,7,8,1,2,3}) |
| 19 | + |
| 20 | +- [ ] Use dynamic programming to find the first X prime numbers |
| 21 | + |
| 22 | +- [ ] Write a function that prints out the binary form of an int |
| 23 | + |
| 24 | +- [ ] Implement parseInt |
| 25 | + |
| 26 | +- [ ] Implement squareroot function |
| 27 | + |
| 28 | +- [ ] Implement an exponent function (bonus: now try in log(n) time) |
| 29 | + |
| 30 | +- [ ] Write a multiply function that multiples 2 integers without using * |
| 31 | + |
| 32 | +- [ ] HARD: Given a function rand5() that returns a random int between 0 and 5, implement rand7() |
| 33 | + |
| 34 | +- [ ] HARD: Given a 2D array of 1s and 0s, count the number of "islands of 1s" (e.g. groups of connecting 1s) |
| 35 | + |
| 36 | +##Strings |
| 37 | +- [ ] Find the first non-repeated character in a String |
| 38 | + |
| 39 | +- [ ] Reverse a String iteratively and recursively |
| 40 | + |
| 41 | +- [ ] Determine if 2 Strings are anagrams |
| 42 | + |
| 43 | +- [ ] Check if String is a palindrome |
| 44 | + |
| 45 | +- [ ] Check if a String is composed of all unique characters |
| 46 | + |
| 47 | +- [ ] Determine if a String is an int or a double |
| 48 | + |
| 49 | +- [ ] HARD: Find the shortest palindrome in a String |
| 50 | + |
| 51 | +- [ ] HARD: Print all permutations of a String |
| 52 | + |
| 53 | +- [ ] HARD: Given a single-line text String and a maximum width value, write the function 'String justify(String text, int maxWidth)' that formats the input text using full-justification, i.e., extra spaces on each line are equally distributed between the words; the first word on each line is flushed left and the last word on each line is flushed right |
| 54 | + |
| 55 | +##Trees |
| 56 | +- [ ] Implement a BST with insert and delete functions |
| 57 | + |
| 58 | +- [ ] Print a tree using BFS and DFS |
| 59 | + |
| 60 | +- [ ] Write a function that determines if a tree is a BST |
| 61 | + |
| 62 | +- [ ] Find the smallest element in a BST |
| 63 | + |
| 64 | +- [ ] Find the 2nd largest number in a BST |
| 65 | + |
| 66 | +- [ ] Given a binary tree which is a sum tree (child nodes add to parent), write an algorithm to determine whether the tree is a valid sum tree |
| 67 | + |
| 68 | +- [ ] Find the distance between 2 nodes in a BST and a normal binary tree |
| 69 | + |
| 70 | +- [ ] Print the coordinates of every node in a binary tree, where root is 0,0 |
| 71 | + |
| 72 | +- [ ] Print a tree by levels |
| 73 | + |
| 74 | +- [ ] Given a binary tree which is a sum tree, write an algorithm to determine whether the tree is a valid sum tree |
| 75 | + |
| 76 | +- [ ] Given a tree, verify that it contains a subtree. |
| 77 | + |
| 78 | +- [ ] HARD: Find the max distance between 2 nodes in a BST. |
| 79 | + |
| 80 | +- [ ] HARD: Construct a BST given the pre-order and in-order traversal Strings |
| 81 | + |
| 82 | +##Stacks, Queues, and Heaps |
| 83 | + |
| 84 | +- [ ] Implement a stack with push and pop functions |
| 85 | + |
| 86 | +- [ ] Implement a queue with queue and dequeue functions |
| 87 | + |
| 88 | +- [ ] Find the minimum element in a stack in O(1) time |
| 89 | + |
| 90 | +- [ ] Write a function that sorts a stack (bonus: sort the stack in place without extra memory) |
| 91 | + |
| 92 | +- [ ] Implement a binary min heap. Turn it into a binary max heap |
| 93 | + |
| 94 | +- [ ] HARD: Implement a queue using 2 stacks |
| 95 | + |
| 96 | +##Linked Lists |
| 97 | + |
| 98 | +- [ ] Implement a linked list (with insert and delete functions) |
| 99 | + |
| 100 | +- [ ] Find the Nth element in a linked list |
| 101 | + |
| 102 | +- [ ] Remove the Nth element of a linked list |
| 103 | + |
| 104 | +- [ ] Check if a linked list has cycles |
| 105 | + |
| 106 | +- [ ] Given a circular linked list, find the node at the beginning of the loop. |
| 107 | + - Example: A-->B-->C --> D-->E -->C, C is the node that begins the loop |
| 108 | + |
| 109 | +- [ ] Check whether a link list is a palindrome |
| 110 | + |
| 111 | +- [ ] Reverse a linked list iteratively and recursively |
| 112 | + |
| 113 | +##Sorting |
| 114 | + |
| 115 | +- [ ] Implement bubble sort |
| 116 | + |
| 117 | +- [ ] Implement selection sort |
| 118 | + |
| 119 | +- [ ] Implement insertion sort |
| 120 | + |
| 121 | +- [ ] Implement merge sort |
| 122 | + |
| 123 | +- [ ] Implement quick sort |
0 commit comments