This file contains 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 n x m matrix where all of the units are 0s except for an 1 | |
for “start”, a 2 for “end”, and 3s for walls, find the shortest paths | |
that you can take to get from 1 to 2, while working around 3s. | |
Example: | |
let grid = [ | |
[1,0,0], |
This file contains 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 two integer arrays of size n, return a new array of size n such that | |
n consists of only unique elements and the sum of all its elements is maximum. | |
Example: | |
let arr1 = [7, 4, 10, 0, 1] | |
let arr2 = [9, 7, 2, 3, 6] |
This file contains 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 went on a vacation with friends. Each of you paid for certain meals | |
on the trip for the group. Write a function that determines who owes | |
money to whom so that everyone pays equally. | |
Example: | |
let receipts = [ | |
{ name: 'Ximena', paid: 45 }, |
This file contains 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 = """ | |
Implement a simple version of autocomplete, where given an input string s and a | |
dictionary of words dict, return the word(s) in dict that partially match s | |
(or an empty string if nothing matches). | |
Example: | |
let dict = ['apple', 'banana', 'cranberry', 'strawberry'] |
This file contains 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 intervals, merge the overlapping intervals, and return an array of the resulting intervals. | |
Example: | |
$ mergeIntervals([[1,4],[2,6],[8,10],[15,20]]) | |
$ [[1,6],[8,10],[15,20]] | |
$ mergeIntervals([[1,2],[2,7]]) |
This file contains 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
from english_words import english_words_set | |
alphabet = [] | |
for ch in range(0, 26): | |
alphabet.append(chr(97 + ch)) | |
def change_a_letter(words): | |
letters = [] | |
for letter in words.strip().lower(): | |
letters.append(letter) |
This file contains 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 unsorted array of integers and a number n, find the subarray of length n that has the largest sum. | |
Example: | |
$ largestSubarraySum([3,1,4,1,5,9,2,6], 3) | |
$ [9, 2, 6] | |
This file contains 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 integer n representing the number of sides of a regular polygon, | |
return the measure of each interior angle. Bonus points: implement some of | |
the other functions listed in the linked Wikipedia page! | |
Example: | |
$ interiorAngleSize(3) | |
$ 60 // Each angle in a triangle that is a regular polygon is 60 degrees |
This file contains 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 two strings n and m, return true if they are equal when both are entered into | |
text editors. But: a # means a backspace character (deleting backwards), and a % means | |
a delete character (deleting forwards). | |
Example: | |
> equalWithDeletions("a##x", "#a#x") | |
> true // both strings become "x" |
This file contains 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 that represents items as asterisks (*) and compartment walls as pipes (|), | |
a start index, and an end index, return the number of items in a closed compartment. | |
Example: | |
let str = '|**|*|*' | |
> containedItems(str, 0, 5) |