Skip to content

Instantly share code, notes, and snippets.

@biglovisa
Created October 15, 2019 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save biglovisa/0da65883fc91d40dd013ebf9b6d221cf to your computer and use it in GitHub Desktop.
Save biglovisa/0da65883fc91d40dd013ebf9b6d221cf to your computer and use it in GitHub Desktop.
questions
Note: I'm not giving you any interaction patterns so that you get the chance to construct your own.
Questions
--------------
- Given a word, find all of it's anagram in the (English) dictionary
- Given a string, determine whether or not it is a palindrome
- Implement a vending machine. I want to be able to buy, restock, and see what the current inventory is.
- To consider:
- what if my inventory is negative when I try to buy something?
- what if I am restocking an item that doesn't exist
- what if I want to view inventory when there is none?
- what data structure should I use for most flexibility/best performance?
- Extension: be able to calculate change
- what if I don't have enough money?
- Implement a so-called Polish calculator. A polish calculator takes in number and notaions, but all notation is in the beginning of the equation.
- + 5 6 => 11
- * (+ 5 6) 2 => 22
- % (- 3 1) 1 => 2
- + (% (- 3 1) 1) 6 => 8
- Implement a stack. A stack is a data structure that follows the "last in, first out" concept.
For example, imagine a stack of plates. You can only add plates from the top (end) and take plates off the top (end).
In order to get to the first plate in the stack you would have to remove all plates on top of it first.
- Implement a stack that has the following methods/functions on it: push/pop/retreiving the first element in the stack.
- Given a string, find all characters that appear more than once.
- Given a string, find all characters that are preceeded by an "x" or "X".
- Implement your own "filter" enumerable/iterable. You may only use a for loop. For example, given an array of strings and integers, I want to use your filter method to only return strings.
- extension: be able to pass in the criteria for the filter (for example only keep the strings, only keep the integers, only keep integers greather than 0 etc).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment