This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| question = """ | |
| You're in charge of the fireworks display, and you have a list of fireworks | |
| to shoot off. You want to make sure you don't fire the same colors twice in a row. | |
| Given an array of fireworks, return a valid firing order. You decide how you want an | |
| impossible solution to work! | |
| Example: | |
| $ orderFireworks(['green','green','green','red','red','blue']) | |
| $ ['green','red','green','red','green','blue'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| question = """ | |
| Design a data structure and functions for a white elephant game. | |
| You'll want to have a set of players and gifts they bring, and | |
| the gifts they end up with in the end! | |
| """ | |
| import random | |
| from pprint import pprint |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| question = """ | |
| Given a file named merry-christmas.txt that has a single integer x in it, | |
| write a script to generate a Christmas tree with asterisks (*) and output | |
| it as happy-holidays.txt. The tree should have a height of x, and if | |
| merry-christmas.txt is empty, the height should be 25 asterisks tall. | |
| Example (you can be flexible with your output, but this might be helpful | |
| for you as a starting point): | |
| // merry-christmas.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| question = """ | |
| You have to order wrapping paper for presents. Given the length, width, | |
| and height of the boxes you need to wrap, return the number of square feet | |
| (or whatever units you want) of wrapping paper you need to order. | |
| Extra credit: allow for other shapes of presents and their dimensions! | |
| Example: | |
| $ wrap(2, 3, 4) | |
| $ 52 square feet |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| question = """ | |
| Given a string containing digits from 2-9, return all possible letter combinations | |
| that the number could represent based on phone numbers/letters. For example, | |
| 2 could be a, b, or c, 3 could be d, e, or f, and so on. | |
| Example: | |
| $ phoneLetter('9') | |
| $ ['w', 'x', 'y', 'z'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| question = """ | |
| Given an array of strings, group the anagrams together in separate arrays. | |
| An anagram is a word or phrase formed by rearranging the letters of another | |
| word or phrase, using all the original letters exactly once. | |
| Example: | |
| $ groupAnagrams(["eat","tea","ten","poop","net","ate"]) | |
| $ [["poop"],["net","ten"],["eat","tea","ate"]] | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| question = """ | |
| Given an array of integers, return the index of each local peak in the array. | |
| A “peak” element is an element that is greater than its neighbors. | |
| $ localPeaks([1,2,3,1]) | |
| $ [2] | |
| $ localPeaks([1,3,2,3,5,6,4]) | |
| $ [1, 5] | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| question = """ | |
| Given a string s where some of the letters can be “wilds” (denoted by an underscore _), | |
| find the longest palindrome possible from the letters of s in order, where the wilds | |
| can be any character. | |
| Example: | |
| $ longestPalindrome('abcb_cbcbafg') | |
| $ 'abcbccbcba' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def binOr(x, y): | |
| if x == '0' and y == '0': | |
| return 0 | |
| elif x == '1' and y == '1': | |
| return 2 | |
| else: | |
| return 1 | |
| a = 10 | |
| b = 20 | |
| bin_a = str(str(bin(a))[2::])[::-1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| question = """ | |
| Given an array of objects A, and an array of indexes B, reorder the objects in array A with the given indexes in array B. | |
| Example: | |
| let a = [C, D, E, F, G, H]; | |
| let b = [3, 0, 4, 1, 2, 5]; | |
| $ reorder(a, b) // a is now [D, F, G, C, E, H] | |
| """ |