├── .gitignore ├── 00_data_science_problems ├── problem_1.txt ├── problem_10.txt ├── problem_100.txt ├── problem_101.txt ├── problem_102.txt ├── problem_103.txt ├── problem_104.txt ├── problem_105.txt ├── problem_106.txt ├── problem_107.txt ├── problem_108.txt ├── problem_109.txt ├── problem_11.txt ├── problem_110.txt ├── problem_111.txt ├── problem_112.txt ├── problem_113.txt ├── problem_114.txt ├── problem_115.txt ├── problem_116.txt ├── problem_117.txt ├── problem_118.txt ├── problem_119.txt ├── problem_12.txt ├── problem_120.txt ├── problem_121.txt ├── problem_122.txt ├── problem_123.txt ├── problem_124.txt ├── problem_125.txt ├── problem_126.txt ├── problem_127.txt ├── problem_13.txt ├── problem_14.txt ├── problem_15.txt ├── problem_16.txt ├── problem_17.txt ├── problem_18.txt ├── problem_19.txt ├── problem_2.txt ├── problem_20.txt ├── problem_21.txt ├── problem_22.txt ├── problem_23.txt ├── problem_24.txt ├── problem_25.txt ├── problem_26.txt ├── problem_27.txt ├── problem_28.txt ├── problem_29.txt ├── problem_3.txt ├── problem_30.txt ├── problem_31.txt ├── problem_32.txt ├── problem_33.txt ├── problem_34.txt ├── problem_35.txt ├── problem_36.txt ├── problem_37.txt ├── problem_38.txt ├── problem_39.txt ├── problem_4.txt ├── problem_40.txt ├── problem_41.txt ├── problem_42.txt ├── problem_43.txt ├── problem_44.txt ├── problem_45.txt ├── problem_46.txt ├── problem_47.txt ├── problem_48.txt ├── problem_49.txt ├── problem_5.txt ├── problem_50.txt ├── problem_51.txt ├── problem_52.txt ├── problem_53.txt ├── problem_54.txt ├── problem_55.txt ├── problem_56.txt ├── problem_57.txt ├── problem_58.txt ├── problem_59.txt ├── problem_6.txt ├── problem_60.txt ├── problem_61.txt ├── problem_62.txt ├── problem_63.txt ├── problem_64.txt ├── problem_65.txt ├── problem_66.txt ├── problem_67.txt ├── problem_68.txt ├── problem_69.txt ├── problem_7.txt ├── problem_70.txt ├── problem_71.txt ├── problem_72.txt ├── problem_73.txt ├── problem_74.txt ├── problem_75.txt ├── problem_76.txt ├── problem_77.txt ├── problem_78.txt ├── problem_79.txt ├── problem_8.txt ├── problem_80.txt ├── problem_81.txt ├── problem_82.txt ├── problem_83.txt ├── problem_84.txt ├── problem_85.txt ├── problem_86.txt ├── problem_87.txt ├── problem_88.txt ├── problem_89.txt ├── problem_9.txt ├── problem_90.txt ├── problem_91.txt ├── problem_92.txt ├── problem_93.txt ├── problem_94.txt ├── problem_95.txt ├── problem_96.txt ├── problem_97.txt ├── problem_98.txt └── problem_99.txt ├── 01_product_problems ├── problem_1.txt ├── problem_10.txt ├── problem_100.txt ├── problem_101.txt ├── problem_102.txt ├── problem_103.txt ├── problem_104.txt ├── problem_105.txt ├── problem_106.txt ├── problem_107.txt ├── problem_108.txt ├── problem_109.txt ├── problem_11.txt ├── problem_110.txt ├── problem_111.txt ├── problem_112.txt ├── problem_113.txt ├── problem_114.txt ├── problem_115.txt ├── problem_116.txt ├── problem_117.txt ├── problem_118.txt ├── problem_119.txt ├── problem_12.txt ├── problem_120.txt ├── problem_121.txt ├── problem_122.txt ├── problem_123.txt ├── problem_124.txt ├── problem_125.txt ├── problem_126.txt ├── problem_127.txt ├── problem_128.txt ├── problem_129.txt ├── problem_13.txt ├── problem_130.txt ├── problem_131.txt ├── problem_132.txt ├── problem_133.txt ├── problem_134.txt ├── problem_135.txt ├── problem_136.txt ├── problem_137.txt ├── problem_138.txt ├── problem_139.txt ├── problem_14.txt ├── problem_140.txt ├── problem_141.txt ├── problem_142.txt ├── problem_143.txt ├── problem_144.txt ├── problem_145.txt ├── problem_146.txt ├── problem_147.txt ├── problem_148.txt ├── problem_149.txt ├── problem_15.txt ├── problem_150.txt ├── problem_151.txt ├── problem_152.txt ├── problem_153.txt ├── problem_154.txt ├── problem_155.txt ├── problem_156.txt ├── problem_157.txt ├── problem_158.txt ├── problem_159.txt ├── problem_16.txt ├── problem_160.txt ├── problem_161.txt ├── problem_162.txt ├── problem_163.txt ├── problem_164.txt ├── problem_165.txt ├── problem_166.txt ├── problem_167.txt ├── problem_168.txt ├── problem_169.txt ├── problem_17.txt ├── problem_170.txt ├── problem_171.txt ├── problem_172.txt ├── problem_173.txt ├── problem_174.txt ├── problem_175.txt ├── problem_176.txt ├── problem_177.txt ├── problem_178.txt ├── problem_179.txt ├── problem_18.txt ├── problem_180.txt ├── problem_181.txt ├── problem_182.txt ├── problem_183.txt ├── problem_184.txt ├── problem_185.txt ├── problem_186.txt ├── problem_187.txt ├── problem_188.txt ├── problem_189.txt ├── problem_19.txt ├── problem_190.txt ├── problem_191.txt ├── problem_192.txt ├── problem_193.txt ├── problem_194.txt ├── problem_195.txt ├── problem_196.txt ├── problem_197.txt ├── problem_198.txt ├── problem_199.txt ├── problem_2.txt ├── problem_20.txt ├── problem_200.txt ├── problem_201.txt ├── problem_202.txt ├── problem_203.txt ├── problem_204.txt ├── problem_205.txt ├── problem_206.txt ├── problem_207.txt ├── problem_208.txt ├── problem_209.txt ├── problem_21.txt ├── problem_210.txt ├── problem_211.txt ├── problem_212.txt ├── problem_213.txt ├── problem_214.txt ├── problem_215.txt ├── problem_216.txt ├── problem_217.txt ├── problem_218.txt ├── problem_219.txt ├── problem_22.txt ├── problem_220.txt ├── problem_221.txt ├── problem_222.txt ├── problem_223.txt ├── problem_224.txt ├── problem_225.txt ├── problem_226.txt ├── problem_227.txt ├── problem_228.txt ├── problem_229.txt ├── problem_23.txt ├── problem_230.txt ├── problem_231.txt ├── problem_232.txt ├── problem_233.txt ├── problem_234.txt ├── problem_235.txt ├── problem_236.txt ├── problem_237.txt ├── problem_238.txt ├── problem_239.txt ├── problem_24.txt ├── problem_240.txt ├── problem_241.txt ├── problem_242.txt ├── problem_243.txt ├── problem_244.txt ├── problem_245.txt ├── problem_246.txt ├── problem_247.txt ├── problem_248.txt ├── problem_249.txt ├── problem_25.txt ├── problem_250.txt ├── problem_26.txt ├── problem_27.txt ├── problem_28.txt ├── problem_29.txt ├── problem_3.txt ├── problem_30.txt ├── problem_31.txt ├── problem_32.txt ├── problem_33.txt ├── problem_34.txt ├── problem_35.txt ├── problem_36.txt ├── problem_37.txt ├── problem_38.txt ├── problem_39.txt ├── problem_4.txt ├── problem_40.txt ├── problem_41.txt ├── problem_42.txt ├── problem_43.txt ├── problem_44.txt ├── problem_45.txt ├── problem_46.txt ├── problem_47.txt ├── problem_48.txt ├── problem_49.txt ├── problem_5.txt ├── problem_50.txt ├── problem_51.txt ├── problem_52.txt ├── problem_53.txt ├── problem_54.txt ├── problem_55.txt ├── problem_56.txt ├── problem_57.txt ├── problem_58.txt ├── problem_59.txt ├── problem_6.txt ├── problem_60.txt ├── problem_61.txt ├── problem_62.txt ├── problem_63.txt ├── problem_64.txt ├── problem_65.txt ├── problem_66.txt ├── problem_67.txt ├── problem_68.txt ├── problem_69.txt ├── problem_7.txt ├── problem_70.txt ├── problem_71.txt ├── problem_72.txt ├── problem_73.txt ├── problem_74.txt ├── problem_75.txt ├── problem_76.txt ├── problem_77.txt ├── problem_78.txt ├── problem_79.txt ├── problem_8.txt ├── problem_80.txt ├── problem_81.txt ├── problem_82.txt ├── problem_83.txt ├── problem_84.txt ├── problem_85.txt ├── problem_86.txt ├── problem_87.txt ├── problem_88.txt ├── problem_89.txt ├── problem_9.txt ├── problem_90.txt ├── problem_91.txt ├── problem_92.txt ├── problem_93.txt ├── problem_94.txt ├── problem_95.txt ├── problem_96.txt ├── problem_97.txt ├── problem_98.txt └── problem_99.txt ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── adobe_problems └── problem_1.py ├── affirme_problems └── problem_1.py ├── airbnb_problems ├── problem_1.py ├── problem_10.py ├── problem_2.py ├── problem_3.py ├── problem_4.py ├── problem_5.py ├── problem_6.py ├── problem_7.py ├── problem_8.py └── problem_9.py ├── airtable_problems └── problem_1.py ├── alibaba_problems └── problem_1.py ├── amazon_problems ├── problem_1.py ├── problem_10.py ├── problem_11.py ├── problem_12.py ├── problem_13.py ├── problem_14.py ├── problem_15.py ├── problem_16.py ├── problem_17.py ├── problem_18.py ├── problem_19.py ├── problem_2.py ├── problem_20.py ├── problem_21.py ├── problem_22.py ├── problem_23.py ├── problem_24.py ├── problem_25.py ├── problem_26.py ├── problem_27.py ├── problem_28.py ├── problem_29.py ├── problem_3.py ├── problem_30.py ├── problem_31.py ├── problem_32.py ├── problem_33.py ├── problem_4.py ├── problem_5.py ├── problem_6.py ├── problem_7.py ├── problem_8.py └── problem_9.py ├── apple_problems ├── problem_1.py ├── problem_10.py ├── problem_11.py ├── problem_12.py ├── problem_13.py ├── problem_14.py ├── problem_2.py ├── problem_3.py ├── problem_4.py ├── problem_5.py ├── problem_6.py ├── problem_7.py ├── problem_8.py └── problem_9.py ├── atlassian_problems └── problem_1.py ├── bloomberg_problems ├── problem_1.py └── problem_2.py ├── butterbox_problems └── problem_1.py ├── cisco_problems └── problem_1.py ├── citrix_problems └── problem_1.py ├── coinbase_problems └── problem_1.py ├── context_logic_problems └── problem_1.py ├── coursera_problems └── problem_1.py ├── data_structure ├── __pycache__ │ └── linked_list.cpython-36.pyc └── linked_list.py ├── dropbox_problem ├── problem_1.py ├── problem_10.py ├── problem_11.py ├── problem_12.py ├── problem_2.py ├── problem_3.py ├── problem_4.py ├── problem_5.py ├── problem_6.py ├── problem_7.py ├── problem_8.py └── problem_9.py ├── epic_problems └── problem_1.py ├── etsy_problems ├── problem_1.py └── problem_2.py ├── facebook_problems ├── problem_1.py ├── problem_10.py ├── problem_11.py ├── problem_12.py ├── problem_13.py ├── problem_14.py ├── problem_15.py ├── problem_16.py ├── problem_17.py ├── problem_18.py ├── problem_19.py ├── problem_2.py ├── problem_20.py ├── problem_21.py ├── problem_22.py ├── problem_23.py ├── problem_24.py ├── problem_25.py ├── problem_26.py ├── problem_27.py ├── problem_28.py ├── problem_29.py ├── problem_3.py ├── problem_30.py ├── problem_31.py ├── problem_32.py ├── problem_33.py ├── problem_34.py ├── problem_35.py ├── problem_36.py ├── problem_37.py ├── problem_38.py ├── problem_39.py ├── problem_4.py ├── problem_40.py ├── problem_41.py ├── problem_42.py ├── problem_43.py ├── problem_5.py ├── problem_6.py ├── problem_7.py ├── problem_8.py └── problem_9.py ├── fitbit_problems └── problem_1.py ├── flipkart_problems ├── problem_1.py └── problem_2.py ├── glassdoor_problems └── problem_1.py ├── goldman_sachs_problems ├── problem_1.py ├── problem_2.py └── problem_3.py ├── google_problems ├── problem_1.py ├── problem_10.py ├── problem_11.py ├── problem_12.py ├── problem_13.py ├── problem_14.py ├── problem_15.py ├── problem_16.py ├── problem_17.py ├── problem_18.py ├── problem_19.py ├── problem_2.py ├── problem_20.py ├── problem_21.py ├── problem_22.py ├── problem_23.py ├── problem_24.py ├── problem_25.py ├── problem_26.py ├── problem_27.py ├── problem_28.py ├── problem_29.py ├── problem_3.py ├── problem_30.py ├── problem_31.py ├── problem_32.py ├── problem_33.py ├── problem_34.py ├── problem_35.py ├── problem_36.py ├── problem_37.py ├── problem_38.py ├── problem_39.py ├── problem_4.py ├── problem_40.py ├── problem_41.py ├── problem_42.py ├── problem_43.py ├── problem_44.py ├── problem_45.py ├── problem_46.py ├── problem_47.py ├── problem_48.py ├── problem_49.py ├── problem_5.py ├── problem_50.py ├── problem_51.py ├── problem_52.py ├── problem_53.py ├── problem_54.py ├── problem_55.py ├── problem_56.py ├── problem_57.py ├── problem_58.py ├── problem_59.py ├── problem_6.py ├── problem_60.py ├── problem_61.py ├── problem_62.py ├── problem_63.py ├── problem_64.py ├── problem_65.py ├── problem_66.py ├── problem_67.py ├── problem_68.py ├── problem_69.py ├── problem_7.py ├── problem_70.py ├── problem_71.py ├── problem_72.py ├── problem_73.py ├── problem_74.py ├── problem_75.py ├── problem_76.cpp ├── problem_77.py ├── problem_78.py ├── problem_79.py ├── problem_8.py ├── problem_80.py ├── problem_81.py ├── problem_82.py ├── problem_83.py ├── problem_84.py ├── problem_85.py ├── problem_86.py ├── problem_87.cpp ├── problem_88.py ├── problem_89.py └── problem_9.py ├── grammarly_problems └── problem_1.py ├── gusto_problems └── problem_1.py ├── header_image.jpg ├── ibm_problems ├── problem_1.py └── problem_2.py ├── indeed_problems └── problem_1.py ├── jane_street_problems ├── problem_1.py ├── problem_2.py ├── problem_3.py ├── problem_4.py ├── problem_5.py └── problem_6.py ├── linked_in_problems ├── problem_1.py ├── problem_2.py ├── problem_3.py ├── problem_4.py ├── problem_5.py ├── problem_6.py ├── problem_7.py └── problem_8.py ├── lyft_problems └── problem_1.py ├── mailchimp_problems └── problem_1.py ├── microsoft_problems ├── problem_1.py ├── problem_10.py ├── problem_11.py ├── problem_12.py ├── problem_13.py ├── problem_14.py ├── problem_15.py ├── problem_16.py ├── problem_17.py ├── problem_18.py ├── problem_19.py ├── problem_2.py ├── problem_20.py ├── problem_21.py ├── problem_22.py ├── problem_23.py ├── problem_24.py ├── problem_25.py ├── problem_26.py ├── problem_27.py ├── problem_28.py ├── problem_29.py ├── problem_3.py ├── problem_4.py ├── problem_5.py ├── problem_6.py ├── problem_7.py ├── problem_8.py └── problem_9.py ├── mit_problems └── problem_1.py ├── mongo_db_problems └── problem_1.py ├── morgan_stanley_problems └── problem_1.py ├── mozila_problems └── problem_1.py ├── nest_problems └── problem_1.py ├── netflix_problems ├── problem_1.py ├── problem_2.py ├── problem_3.py └── problem_4.py ├── nextdoor_problems └── problem_1.py ├── nvidia_problems ├── problem_1.py └── problem_2.py ├── oracle_problems ├── problem_1.py ├── problem_2.py └── problem_3.py ├── others_problems ├── problem_1.py ├── problem_2.py ├── problem_3.py ├── problem_4.py ├── problem_5.py ├── problem_6.py ├── problem_7.py ├── problem_8.py └── problem_9.py ├── pagerduty_problems └── problem_1.py ├── palantir_problems ├── problem_1.py ├── problem_2.py ├── problem_3.py ├── problem_4.py ├── problem_5.py ├── problem_6.py ├── problem_7.py └── problem_8.py ├── panadora_problems └── problem_1.py ├── paypal_problems ├── problem_1.py ├── problem_2.py └── problem_3.py ├── pinterest_problems ├── problem_1.py ├── problem_2.py ├── problem_3.py └── problem_4.py ├── pivotal_problems ├── problem_1.py └── problem_2.py ├── quantcast_problems ├── problem_1.py └── problem_2.py ├── quora_problems ├── problem_1.py ├── problem_2.py ├── problem_3.py └── problem_4.py ├── riot_games_problems └── problem_1.py ├── robinhood_problems ├── problem_1.py └── problem_2.py ├── salesforce_problems ├── problem_1.py ├── problem_2.py ├── problem_3.py └── problem_4.py ├── samsung_problems └── problem_1.py ├── slack_problems ├── problem_1.py └── problem_2.py ├── snapchat_problems ├── problem_1.py ├── problem_2.py ├── problem_3.py ├── problem_4.py └── problem_5.py ├── spotify_problems ├── problem_1.py ├── problem_2.py ├── problem_3.py └── problem_4.py ├── square_problems ├── problem_1.py ├── problem_2.py ├── problem_3.py ├── problem_4.py ├── problem_5.py ├── problem_6.py └── problem_7.py ├── squarespace_problems └── problem_1.py ├── stitch_fix_problems └── problem_1.py ├── stripe_problems ├── problem_1.py ├── problem_2.py ├── problem_3.py ├── problem_4.py ├── problem_5.py └── problem_6.py ├── sumo_logic_problems └── problem_1.py ├── triple_byte_problems ├── problem_1.py └── problem_2.py ├── twitch_problems └── problem_1.py ├── twitter_problems ├── problem_1.py ├── problem_10.py ├── problem_11.py ├── problem_12.py ├── problem_13.py ├── problem_14.py ├── problem_2.py ├── problem_3.py ├── problem_4.py ├── problem_5.py ├── problem_6.py ├── problem_7.py ├── problem_8.py └── problem_9.py ├── two_sigma_problems ├── problem_1.py ├── problem_2.py ├── problem_3.py ├── problem_4.py ├── problem_5.py ├── problem_6.py ├── problem_7.py ├── problem_8.py └── problem_9.py ├── uber_problems ├── problem_1.py ├── problem_10.py ├── problem_11.py ├── problem_2.py ├── problem_3.py ├── problem_4.py ├── problem_5.py ├── problem_6.py ├── problem_7.py ├── problem_8.py └── problem_9.py ├── vmware_problems └── problem_1.py ├── walmart_labs_problems └── problem_1.py ├── wayfair_problems └── problem_1.py ├── wework_problems └── problem_1.py ├── whatsup_problems └── problem_1.py ├── yahoo_problems ├── problem_1.py ├── problem_2.py ├── problem_3.py └── problem_4.py ├── yelp_problems ├── problem_1.py ├── problem_2.py └── problem_3.py ├── yext_problems └── problem_1.py ├── youtube_problems └── problem_1.py └── zillow_problems ├── problem_1.py ├── problem_2.py └── problem_3.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Intellij 2 | .idea/ 3 | -------------------------------------------------------------------------------- /00_data_science_problems/problem_1.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Facebook. 2 | 3 | There is a fair coin (one side heads, one side tails) and an unfair coin (both sides tails). You pick one at random, flip it 5 times, and observe that it comes up as tails all five times. What is the chance that you are flipping the unfair coin? -------------------------------------------------------------------------------- /00_data_science_problems/problem_101.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Twitter. 2 | 3 | Given a string with lowercase characters and left and right parentheses, remove the minimum number of parentheses so that the string is valid. 4 | 5 | For example, if the string is ")a(b((cd)e(f)g)" then return "ab((cd)e(f)g)". -------------------------------------------------------------------------------- /00_data_science_problems/problem_102.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Netflix. 2 | 3 | Describe the idea and mathematical formulation of kernel smoothing. How do you compute the kernel regression estimator? -------------------------------------------------------------------------------- /00_data_science_problems/problem_103.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Slack. 2 | 3 | What are some metrics you would use to measure user engagement at Slack? How would you be able to tell early whether or not user engagement is declining? -------------------------------------------------------------------------------- /00_data_science_problems/problem_104.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Disney. 2 | 3 | Alice and Bob are choosing their top 3 shows from a list of 50 shows. Assume that they choose independently of one another. Being relatively new to Hulu, assume also that they choose randomly within the 50 shows. What is the expected number of shows they have in common, and what is the probability that they do not have any shows in common? -------------------------------------------------------------------------------- /00_data_science_problems/problem_106.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Tesla. 2 | 3 | Say that the lifetime of electric vehicles are modeled using a Gaussian distribution. Each type of electric vehicle has an expected lifetime and a lifetime variance. Say you chose two different types of electric vehicles at random. What is the probability that the two lifetimes will be within n time units? -------------------------------------------------------------------------------- /00_data_science_problems/problem_107.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Snapchat. 2 | 3 | Given an arbitrary array of positive integers, find the smallest missing positive integer. Can you do it with O(1) space? 4 | 5 | For example, if A = [1, 3, 6, 2, 7] and then you should return 4. -------------------------------------------------------------------------------- /00_data_science_problems/problem_108.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Facebook. 2 | 3 | Say you roll three dice and observe the sum of the three rolls. What is the probability that the sum of the outcomes is 12, given that the three rolls are different? -------------------------------------------------------------------------------- /00_data_science_problems/problem_109.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Stripe. 2 | 3 | Say we have N observations for some variable which we model as being drawn from a Gaussian distribution. What are your best guesses for the parameters of the distribution? Derive it mathematically. 4 | 5 | -------------------------------------------------------------------------------- /00_data_science_problems/problem_110.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Uber. 2 | 3 | Say you are on the UberEats team and considering shipping out a potential feature X. What metrics would you look at in order to A/B test this change? -------------------------------------------------------------------------------- /00_data_science_problems/problem_111.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Lyft. 2 | 3 | Suppose you roll a fair die n times, where n is very large. What is the average time between occurrences of a given number? -------------------------------------------------------------------------------- /00_data_science_problems/problem_113.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Opendoor. 2 | 3 | Assume you are given the below table on house prices from various zip codes that have been listed. Write a query to get the top 5 zip codes by market share of house prices for any zip code with at least 10000 houses. 4 | 5 | house_listings 6 | column_name type 7 | house_id integer 8 | zip_code integer 9 | price float 10 | listing_date datetime 11 | -------------------------------------------------------------------------------- /00_data_science_problems/problem_114.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Robinhood. 2 | 3 | Say X and Y are independent and uniformly distributed on (0, 1). What is the expected value of X, given that X > Y? -------------------------------------------------------------------------------- /00_data_science_problems/problem_115.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Snapchat. 2 | 3 | You are testing a new feature with various sample groups of three people. Assume that each person is equally likely to be a fan or not a fan of the feature. What is the probability that a randomly chosen group has exactly one fan, given that there is a fan among the three? -------------------------------------------------------------------------------- /00_data_science_problems/problem_116.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Lyft. 2 | 3 | Given an array A of positive integers and an integer k, write a function to get the largest value within the sliding window of size k for A. Each sliding window is k numbers and moves from the leftmost to the rightmost within A, one position at a time. 4 | 5 | For example, if A = [2, 5, 3, 1, 4] and n = 2, then you should return [5, 5, 3, 4]. -------------------------------------------------------------------------------- /00_data_science_problems/problem_117.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Uber. 2 | 3 | Uber Pro is a program that is designed to reward outstanding drivers. Think of it like a reward program on the driver side. What do you think are the important metrics for Uber Pro to look at, and how might Uber be able to tell if the service is effective? -------------------------------------------------------------------------------- /00_data_science_problems/problem_118.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Airbnb. 2 | 3 | Suppose you are running a linear regression and model the error terms as being normally distributed. Show that in this setup, maximizing the likelihood of the data is equivalent to minimizing the sum of squared residuals. -------------------------------------------------------------------------------- /00_data_science_problems/problem_12.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Google. 2 | 3 | Assume you take have a stick of length 1 and you break it uniformly at random into three parts. What is the probability that the three parts form a triangle? -------------------------------------------------------------------------------- /00_data_science_problems/problem_120.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Etsy. 2 | 3 | Assume you are given the below table on transactions from users for purchases. Write a query to get the list of customers where their earliest purchase was at least $50. 4 | 5 | user_transactions 6 | column_name type 7 | transaction_id integer 8 | product_id integer 9 | user_id integer 10 | spend float 11 | transaction_date datetime 12 | -------------------------------------------------------------------------------- /00_data_science_problems/problem_121.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Facebook. 2 | 3 | Derive the expectation for a geometric distributed random variable. -------------------------------------------------------------------------------- /00_data_science_problems/problem_122.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Twilio. 2 | 3 | You are modeling the wait time a customer has for a support call as exponentially distributed with a mean of 10 minutes. Suppose a customer calls in and is told that all lines are currently busy, and the most recent last spot was occupied 5 minutes ago. What is the probability that the current customer will need to wait no more than another 5 minutes? -------------------------------------------------------------------------------- /00_data_science_problems/problem_123.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Opendoor. 2 | 3 | Given a string, return the count of substrings within the string that are palindromes. 4 | 5 | For example, if input is "aba": return 4, since the palindromes are: "a", "b", "a", and "aba". -------------------------------------------------------------------------------- /00_data_science_problems/problem_124.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Robinhood. 2 | 3 | Say you roll a fair dice 5 times. Let X be the number of times a 2 was rolled, and Y the number of times a 3 was rolled. What is the correlation coefficient between X and Y? -------------------------------------------------------------------------------- /00_data_science_problems/problem_125.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Duolingo. 2 | 3 | How would you measure Duolingo's success from a product standpoint, and another metric you would use to measure its success from a financial standpoint? -------------------------------------------------------------------------------- /00_data_science_problems/problem_126.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Stripe. 2 | 3 | Describe the model formulation behind logistic regression. How do you maximize the log-likelihood of a given model (using the two-class case)? -------------------------------------------------------------------------------- /00_data_science_problems/problem_14.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Airbnb. 2 | 3 | How can you decide how long to run an experiment? What are some problems with just using a fixed p-value threshold and how do you work around them? -------------------------------------------------------------------------------- /00_data_science_problems/problem_15.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Robinhood. 2 | 3 | What is user churn and how can you build a model to predict whether a user will churn? What features would you include in the model and how do you assess importance? -------------------------------------------------------------------------------- /00_data_science_problems/problem_16.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Quora. 2 | 3 | You are drawing from a normally distributed random variable X ~ N(0, 1) once a day. What is the approximate expected number of days until you get a value of more than 2? -------------------------------------------------------------------------------- /00_data_science_problems/problem_17.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Facebook. 2 | 3 | Assume you have the below events table on app analytics. Write a query to get the click-through rate per app in 2019. 4 | 5 | events 6 | column_name type 7 | app_id integer 8 | event_id string ("impression", "click") 9 | timestamp datetime -------------------------------------------------------------------------------- /00_data_science_problems/problem_18.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Lyft. 2 | 3 | What is the expected number of coin flips needed to get two consecutive heads? -------------------------------------------------------------------------------- /00_data_science_problems/problem_19.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Uber. 2 | 3 | You’re on the data science team and are responsible for figuring out surge pricing. Why does it need to exist and what metrics and data should you track? -------------------------------------------------------------------------------- /00_data_science_problems/problem_2.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Google. 2 | 3 | Say we have X ~ Uniform(0, 1) and Y ~ Uniform(0, 1). What is the expected value of the minimum of X and Y? -------------------------------------------------------------------------------- /00_data_science_problems/problem_20.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Facebook. 2 | 3 | There are two games involving dice that you can play. In the first game, you roll two die at once and get the dollar amount equivalent to the product of the rolls. In the second game, you roll one die and get the dollar amount equivalent to the square of that value. Which has the higher expected value and why? -------------------------------------------------------------------------------- /00_data_science_problems/problem_21.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Airbnb. 2 | 3 | Say you are given an unfair coin, with an unknown bias towards heads or tails. How can you generate fair odds using this coin? -------------------------------------------------------------------------------- /00_data_science_problems/problem_22.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Google. 2 | 3 | Say you are given a very large corpus of words. How would you identify synonyms? -------------------------------------------------------------------------------- /00_data_science_problems/problem_23.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Stripe. 2 | 3 | Write a program to generate the partitions for a number n. A partition for n is a list of positive integers that sum up to n. For example: if n = 4, we want to return the following partitions: [1,1,1,1], [1,1,2], [2,2], [1,3], and [4]. Note that a partition [1,3] is the same as [3,1] so only the former is included. -------------------------------------------------------------------------------- /00_data_science_problems/problem_24.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Facebook. 2 | 3 | Three ants are sitting at the corners of an equilateral triangle. Each ant randomly picks a direction and starts moving along the edge of the triangle. What is the probability that none of the ants collide? Now, what if it is k ants on all k corners of an equilateral polygon? -------------------------------------------------------------------------------- /00_data_science_problems/problem_25.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Uber. 2 | 3 | What is L1 and L2 regularization? What are the differences between the two? -------------------------------------------------------------------------------- /00_data_science_problems/problem_26.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Google. 2 | 3 | Say you are running a multiple linear regression and believe there are several predictors that are correlated. How will the results of the regression be affected if they are indeed correlated? How would you deal with this problem? -------------------------------------------------------------------------------- /00_data_science_problems/problem_27.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Airbnb. 2 | 3 | What are some factors that might make testing metrics on the Airbnb platform difficult? -------------------------------------------------------------------------------- /00_data_science_problems/problem_28.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Affirm. 2 | 3 | Assume we have a classifier that produces a score between 0 and 1 for the probability of a particular loan application behind a fraud. Say that for each application’s score, we take the square root of that score. How would the ROC curve change? If it doesn’t change, what kinds of functions would change the curve? -------------------------------------------------------------------------------- /00_data_science_problems/problem_29.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Uber. 2 | 3 | Say you are given a random Bernoulli trial generator. How would you generate values from a standard normal distribution? -------------------------------------------------------------------------------- /00_data_science_problems/problem_3.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Affirm. 2 | 3 | Assume we have a classifier that produces a score between 0 and 1 for the probability of a particular loan application being fraudulent. In this scenario: a) what are false positives, b) what are false negatives, and c) what are the trade-offs between them in terms of dollars and how should the model be weighted accordingly? -------------------------------------------------------------------------------- /00_data_science_problems/problem_30.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Microsoft. 2 | 3 | What is the bias-variance tradeoff? How is it expressed using an equation? -------------------------------------------------------------------------------- /00_data_science_problems/problem_31.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Lyft. 2 | 3 | How many cards would you expect to draw from a standard deck before seeing the first ace? -------------------------------------------------------------------------------- /00_data_science_problems/problem_32.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Lyft. 2 | 3 | How many cards would you expect to draw from a standard deck before seeing the first ace? -------------------------------------------------------------------------------- /00_data_science_problems/problem_33.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Robinhood. 2 | 3 | Write a program to calculate correlation (without any libraries except for math) for two lists X and Y. -------------------------------------------------------------------------------- /00_data_science_problems/problem_34.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Netflix. 2 | 3 | What are MLE and MAP? What is the difference between the two? -------------------------------------------------------------------------------- /00_data_science_problems/problem_35.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Airbnb. 2 | 3 | Say you are modeling the yearly revenue of new listings. What kinds of features would you use? What data processing steps need to be taken, and what kind of model would run? -------------------------------------------------------------------------------- /00_data_science_problems/problem_36.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Quora. 2 | 3 | Assume you want to test whether a new feature increases signups to the site. How would you run this experiment? What statistical test(s) would you use? -------------------------------------------------------------------------------- /00_data_science_problems/problem_37.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Lyft. 2 | 3 | A and B are playing the following game: a number k from 1-6 is chosen, and A and B will toss a die until the first person sees the side k, and that person gets $100. How much is A willing to pay to play first in this game? -------------------------------------------------------------------------------- /00_data_science_problems/problem_38.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Stripe. 2 | 3 | Say we have two random variables X and Y. What does it mean for X and Y to be independent? What about uncorrelated? Give an example where X and Y are uncorrelated but not independent. 4 | 5 | -------------------------------------------------------------------------------- /00_data_science_problems/problem_39.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Stripe. 2 | 3 | Say we have two random variables X and Y. What does it mean for X and Y to be independent? What about uncorrelated? Give an example where X and Y are uncorrelated but not independent. 4 | 5 | -------------------------------------------------------------------------------- /00_data_science_problems/problem_4.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Netflix. 2 | 3 | How would you design a metric to compare rankings of lists of shows for a given user? -------------------------------------------------------------------------------- /00_data_science_problems/problem_40.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Airbnb. 2 | 3 | Say you are tasked with producing a model that can recommend similar listings to an Airbnb user when they are looking at any given listing. What kind of model would you use, what data is needed for that model, and how would you evaluate the model? -------------------------------------------------------------------------------- /00_data_science_problems/problem_41.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Netflix. 2 | 3 | In the streaming context, for A/B testing, what are some metrics and data to track, and what are some differences versus more traditional A/B testing? -------------------------------------------------------------------------------- /00_data_science_problems/problem_42.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Uber. 2 | 3 | Given a list of positive integers, return the maximum increasing subsequence, that is, the largest increasing subsequence within the array that has the maximum sum. Examples: if the input is [5, 4, 3, 2, 1] then return 5 (since no subsequence is increasing), if the input is [3, 2, 5, 7, 6] return 15 = 3 + 5 + 7, etc. -------------------------------------------------------------------------------- /00_data_science_problems/problem_43.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Robinhood. 2 | 3 | A and B are playing a game where A has n+1 coins, B has n coins, and they each flip all of their coins. What is the probability that A will have more heads than B? -------------------------------------------------------------------------------- /00_data_science_problems/problem_44.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Google. 2 | 3 | What are the assumptions behind linear regression? How do you diagnose if any of these assumptions are violated? -------------------------------------------------------------------------------- /00_data_science_problems/problem_45.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Netflix. 2 | 3 | Say we have X ~ Uniform(-1, 1) and Y = X^2. What is the covariance of X and Y? -------------------------------------------------------------------------------- /00_data_science_problems/problem_47.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Lyft. 2 | 3 | Say you have an unfair coin which will land on heads 60% of the time. How many coin flips are needed to detect that the coin is unfair? -------------------------------------------------------------------------------- /00_data_science_problems/problem_48.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Palantir. 2 | 3 | Given a positive integer n, find the smallest number of perfect squares that sum up to n. For example, for n = 7, you should return 4 since 7 = 4 + 1 + 1 +1, and for n = 13, you should return 2 since 13 = 4 + 9. 4 | 5 | -------------------------------------------------------------------------------- /00_data_science_problems/problem_49.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Lyft. 2 | 3 | Your team is trying to figure out whether a new driver app with extra UI features will increase the number of rides taken. How would you test whether the extra features in the app make it better than the original version? -------------------------------------------------------------------------------- /00_data_science_problems/problem_5.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Facebook. 2 | 3 | Assume you have the below tables on user actions. Write a query to get the active user retention by month. 4 | 5 | user_actions 6 | column_name type 7 | user_id integer 8 | event_id string ("sign-in", "like", "comment") 9 | timestamp datetime -------------------------------------------------------------------------------- /00_data_science_problems/problem_50.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Google. 2 | 3 | Say we are running a probabilistic linear regression which does a good job modeling the underlying relationship between some y and x. Now assume all inputs have some noise ε added, which is independent of the training data. What is the new objective function? How do you compute it? -------------------------------------------------------------------------------- /00_data_science_problems/problem_51.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Spotify. 2 | 3 | A fair die is rolled n times. What is the probability that the largest number rolled is r, for each r in 1..6? -------------------------------------------------------------------------------- /00_data_science_problems/problem_53.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Snapchat. 2 | 3 | Assume you have the below tables on sessions that users have, and a users table. Write a query to get the active user count of daily cohorts. 4 | 5 | sessions 6 | column_name type 7 | session_id integer 8 | user_id integer 9 | date datetime 10 | users 11 | column_name type 12 | user_id integer 13 | email string 14 | date datetime 15 | -------------------------------------------------------------------------------- /00_data_science_problems/problem_54.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Stitch Fix. 2 | 3 | How would you build a model to calculate a customer's propensity to buy a particular item? 4 | 5 | What are some pros and cons of your approach? 6 | 7 | -------------------------------------------------------------------------------- /00_data_science_problems/problem_55.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Facebook. 2 | 3 | Let’s say that you are the first person working on the Facebook News Feed. What metrics would you track and how would you improve those metrics? -------------------------------------------------------------------------------- /00_data_science_problems/problem_56.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Lyft. 2 | 3 | Say you pick the radius of a circle from a uniform distribution between 0 and 1. What is the probability density of the area of the resulting circle? -------------------------------------------------------------------------------- /00_data_science_problems/problem_58.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Airbnb. 2 | 3 | Say you model the lifetime for a set of customers using an exponential distribution with parameter λ, and you have the lifetime history (in months) of n customers. What is the MLE for λ? -------------------------------------------------------------------------------- /00_data_science_problems/problem_59.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Facebook. 2 | 3 | Assume you are given the below tables on users and user posts. Write a query to get the distribution of the number of posts per user. 4 | 5 | users 6 | column_name type 7 | user_id integer 8 | date datetime 9 | posts 10 | column_name type 11 | post_id integer 12 | user_id integer 13 | body string 14 | date datetime 15 | -------------------------------------------------------------------------------- /00_data_science_problems/problem_6.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Google. 2 | 3 | A coin was flipped 1000 times, and 550 times it showed up heads. Do you think the coin is biased? Why or why not? -------------------------------------------------------------------------------- /00_data_science_problems/problem_60.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Netflix. 2 | 3 | What is the loss function used in k-means clustering for k clusters and n sample points? Compute the update formula using 4 | 1) batch gradient descent, 5 | 2) stochastic gradient descent for the cluster mean for cluster k using a learning rate ε. -------------------------------------------------------------------------------- /00_data_science_problems/problem_61.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Dropbox. 2 | 3 | Dropbox has just started and there are two servers that service users: a faster server and a slower server. When a user is on the website, they are routed to either server randomly, and the wait time is exponentially distributed with two different parameters. What is the probability density of a random user's waiting time? -------------------------------------------------------------------------------- /00_data_science_problems/problem_62.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Stripe. 2 | 3 | Estimate π using a Monte Carlo method. Hint: think about throwing darts on a square and seeing where they land within a circle. -------------------------------------------------------------------------------- /00_data_science_problems/problem_63.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Twitter. 2 | 3 | How would you improve product engagement on Twitter? -------------------------------------------------------------------------------- /00_data_science_problems/problem_64.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Uber. 2 | 3 | Say you roll three dice, one by one. What is the probability that you obtain 3 numbers in a strictly increasing order? -------------------------------------------------------------------------------- /00_data_science_problems/problem_65.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Spotify. 2 | 3 | Say you draw n samples from a uniform distribution U(a, b). What is the MLE estimate of a and b? -------------------------------------------------------------------------------- /00_data_science_problems/problem_66.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Palantir. 2 | 3 | Given a stream of elements (of arbitrary size), write a class to find the median at any given time. Your class should have a function to add numbers to the stream and a function to calculate the median. -------------------------------------------------------------------------------- /00_data_science_problems/problem_68.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Robinhood. 2 | 3 | Say you are deciding whether to implement two-step authentication when users log in. What data would you look at and how can you make your decision? -------------------------------------------------------------------------------- /00_data_science_problems/problem_69.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Google. 2 | 3 | Say you have two countries of interest and want to compare variances of clicking behavior from users (i.e. total distribution of clicks). How would you do this comparison, and what assumptions need to be met? -------------------------------------------------------------------------------- /00_data_science_problems/problem_7.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Uber. 2 | 3 | Say you need to produce a binary classifier for fraud detection. 4 | 5 | What metrics would you look at, how is each defined, 6 | and what is the interpretation of each one? -------------------------------------------------------------------------------- /00_data_science_problems/problem_70.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Reddit. 2 | 3 | Given an array A of positive integers, a peak element is defined as an element that is greater than its neighbors. 4 | 5 | For example, if A = [3, 5, 2, 4, 1] you should return either 1 or 3 since index 1 is 5, and index 3 is 4, and both are peak elements. Find the index of any peak elements. -------------------------------------------------------------------------------- /00_data_science_problems/problem_74.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Airbnb. 2 | 3 | Suppose we have two random variables X and Y. Under what condition are X+Y and X-Y uncorrelated? -------------------------------------------------------------------------------- /00_data_science_problems/problem_75.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Robinhood. 2 | 3 | A biased coin, with probability p of landing on heads, is tossed n times. Write a recurrence relation for the probability that the total number of heads after n tosses is even. -------------------------------------------------------------------------------- /00_data_science_problems/problem_78.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Facebook. 2 | 3 | Let’s say that the usage of a Facebook posting tool dropped from 2% posts per user last month to 1% post per user today. What might be some potential causes and how would you go about understanding this drop? -------------------------------------------------------------------------------- /00_data_science_problems/problem_79.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Stripe. 2 | 3 | Consider a Bernoulli random variable with parameter p. Say you observe the following samples: [1, 0, 1, 1, 1]. What is the log likelihood function for p and what is the MLE of p? -------------------------------------------------------------------------------- /00_data_science_problems/problem_8.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Facebook. 2 | 3 | Imagine the social graphs for both Facebook and Twitter. How do they differ? What metric would you use to measure how skewed the social graphs are? -------------------------------------------------------------------------------- /00_data_science_problems/problem_80.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Netflix. 2 | 3 | What is Expectation-Maximization and when is it useful? Describe the setup algorithmically with formulas. -------------------------------------------------------------------------------- /00_data_science_problems/problem_81.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Lyft. 2 | 3 | Say that you are pushing a new feature X out. You have 1000 users and each user is either a fan or not a fan of X, at random. There are 50 users of 1000 that do not like X. You will decide whether to ship the feature or not based on sampling 5 users independently and if they all like the feature, you will ship it. What is the probability that you will ship the feature? -------------------------------------------------------------------------------- /00_data_science_problems/problem_82.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Dropbox. 2 | 3 | Given n distinct integers, write a function to generate all permutations of those integers. -------------------------------------------------------------------------------- /00_data_science_problems/problem_83.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Stitch Fix. 2 | 3 | Assume you are given the below table on purchases from users. Write a query to get the number of people that purchased at least one product on multiple days. 4 | 5 | purchases 6 | column_name type 7 | purchase_id integer 8 | user_id integer 9 | product_id integer 10 | quantity integer 11 | price float 12 | purchase_time datetime 13 | -------------------------------------------------------------------------------- /00_data_science_problems/problem_84.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Uber. 2 | 3 | A fair die is rolled n times. What is the expected value and the standard deviation of the smallest number rolled? -------------------------------------------------------------------------------- /00_data_science_problems/problem_86.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Facebook. 2 | 3 | Alice and Bob are playing a new Facebook game together. They play a series of rounds until one of them wins two more rounds than the other. With probability p, Alice will win each round. What is the probability that Bob wins the overall series? -------------------------------------------------------------------------------- /00_data_science_problems/problem_88.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Robinhood. 2 | 3 | Say you have n integers 1...n and take a random permutation. For any integers i, j let a swap be defined as when the integer i is in the jth position, and vice versa. What is the expected value of the total number of swaps? -------------------------------------------------------------------------------- /00_data_science_problems/problem_89.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Pinterest. 2 | 3 | Given two arrays, write a function to get the intersection of the two. 4 | 5 | For example, if A = [2, 4, 1, 5, 0], and B = [3, 4, 5] then you should return [4, 5]. 6 | 7 | -------------------------------------------------------------------------------- /00_data_science_problems/problem_9.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Google. 2 | 3 | What does it mean for an estimator to be unbiased? What about consistent? Give examples of an unbiased but not consistent estimator, as well as a biased but consistent estimator. -------------------------------------------------------------------------------- /00_data_science_problems/problem_90.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Stripe. 2 | 3 | Say we are using a Gaussian Mixture Model (GMM) for anomaly detection on fraudulent transactions to classify incoming transactions into K classes. Describe the model setup formulaically and how to evaluate the posterior probabilities and log likelihood. How can we determine if a new transaction should be deemed fraudulent? -------------------------------------------------------------------------------- /00_data_science_problems/problem_91.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Wayfair. 2 | 3 | If you are selling a product and want to decrease the shipment time from 2 days to 1 day to increase your amount of customers, what are 2 ways to quantify it and 2 risks of this idea? -------------------------------------------------------------------------------- /00_data_science_problems/problem_93.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Lyft. 2 | 3 | Suppose we have two random variables, X and Y, which are bivariate normal. The correlation between them is -0.2. Let A = cX + Y and B = X + cY. For what values of c are A and B independent? -------------------------------------------------------------------------------- /00_data_science_problems/problem_94.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by LinkedIn. 2 | 3 | LinkedIn recently launched a "status" feature where you can now see if a LinkedIn connection is online, symbolized by a green dot, idle, symbolized by an orange dot, or offline (grey dot) status that says how long ago the user was active. Assume that this feature has been around for a few months. What metrics would you look at to assess the success of this feature? -------------------------------------------------------------------------------- /00_data_science_problems/problem_96.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Airbnb. 2 | 3 | Given a number x, define a palindromic subset as any subsequence within x that is a palindrome. Write a function that returns the number of digits of the longest palindromic subset. 4 | 5 | For example, if x is 93567619 then you should return 5 since the longest subset would be 96769, which is a 5 digit number. -------------------------------------------------------------------------------- /00_data_science_problems/problem_97.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Tesla. 2 | 3 | Suppose there is a new vehicle launch upcoming. Initial data suggests that any given day there is either a malfunction with some part of the vehicle or possibility of a crash, with probability p which then requires a replacement. Additionally, each vehicle that has been around for n days must be replaced. What is the long-term frequency of vehicle replacements? -------------------------------------------------------------------------------- /00_data_science_problems/problem_98.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Microsoft. 2 | 3 | Explain what Information Gain and Entropy are in a Decision Tree. 4 | 5 | -------------------------------------------------------------------------------- /00_data_science_problems/problem_99.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Snapchat. 2 | 3 | Say you have a large amount of user data that measures the lifetime of each user. Assume you model each lifetime as exponentially distributed random variables. What is the likelihood ratio for assessing two potential λ values, one from the null hypothesis and the other from the alternative hypothesis? -------------------------------------------------------------------------------- /01_product_problems/problem_1.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Facebook. 2 | 3 | Design a jobs product for Facebook. 4 | 5 | Make it harder? Assume the product is for blue-collar workers. -------------------------------------------------------------------------------- /01_product_problems/problem_10.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Facebook. 2 | 3 | You're the PM of Facebook Groups and you notice usage has dropped 20%. What are your next steps? 4 | 5 | Make it harder? The drop has been gradual for the past two weeks. -------------------------------------------------------------------------------- /01_product_problems/problem_100.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Instagram. 2 | 3 | We recently made a pretty big decision to remove the like count on posts. Why do you think we did this? 4 | 5 | Make it harder? Name at least three reasons and rank them. -------------------------------------------------------------------------------- /01_product_problems/problem_101.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Adobe. 2 | 3 | Singapore has grown into one of the largest financial hubs in the world. Let's say your job was to push Creative Cloud for small businesses in Singapore. What would you do? 4 | 5 | Make it harder? Provide at least five different channels that Adobe could use. -------------------------------------------------------------------------------- /01_product_problems/problem_102.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Facebook. 2 | 3 | How would you measure improvements made to Facebook Messenger? 4 | 5 | Make it harder? Analyze at least two different behaviors. -------------------------------------------------------------------------------- /01_product_problems/problem_103.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Atlassian. 2 | 3 | How can a product like Slack make collaboration even better? 4 | 5 | Make it harder? Define at least two user types. -------------------------------------------------------------------------------- /01_product_problems/problem_104.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Whole Foods. 2 | 3 | Our digital team prides itself on experimentation. Let's say you ran an experiment and needed to communicate the results to other teams - how would you communicate in a way so everyone understands? 4 | 5 | Make it harder? Provide an example with three different stakeholders. -------------------------------------------------------------------------------- /01_product_problems/problem_105.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Amazon. 2 | 3 | What's your biggest weakness? 4 | 5 | Make it harder? Use stubbornness as your answer. 6 | -------------------------------------------------------------------------------- /01_product_problems/problem_106.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Facebook. 2 | 3 | Estimate the bandwidth (bits / s) of a 747 crossing the Atlantic filled with CDs. 4 | 5 | Make it harder? Ask a friend use this question to mock you! -------------------------------------------------------------------------------- /01_product_problems/problem_107.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Lyft. 2 | 3 | What's your biggest weakness? 4 | 5 | Make it harder? Use rambling too often as your answer. -------------------------------------------------------------------------------- /01_product_problems/problem_108.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Google. 2 | 3 | Why do you want to work at Google? 4 | 5 | Make it harder? Provide at least three distinct reasons. -------------------------------------------------------------------------------- /01_product_problems/problem_109.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Facebook. 2 | 3 | One of my favorite apps right now is Notion. Let's say you were their product manager and you wanted them to expand into Europe. What would you do? 4 | 5 | Make it harder? Provide at least five different channels that Notion could use. -------------------------------------------------------------------------------- /01_product_problems/problem_11.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Google. 2 | 3 | How many Hershey's chocolate bars were sold in the US last year? 4 | 5 | Make it harder? Consider at least two edge cases you didn't think of initially in your formula. -------------------------------------------------------------------------------- /01_product_problems/problem_110.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Pinterest. 2 | 3 | If you were a product manager, how would you improve Pinterest? 4 | 5 | Make it harder? Offer at least two unique improvements. -------------------------------------------------------------------------------- /01_product_problems/problem_111.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Amazon. 2 | 3 | [Amazon.com](http://amazon.com) is one of the most visited e-commerce sites in the world. We handle millions of transactions each day. What are some endpoints Amazon.com might have? 4 | 5 | Make it harder? List at least 5 different endpoints. -------------------------------------------------------------------------------- /01_product_problems/problem_112.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by LinkedIn. 2 | 3 | What's your favorite product and why? 4 | 5 | For this problem we'll be using Chrome. 6 | 7 | Make it harder? Follow along and use Chrome as your answer. -------------------------------------------------------------------------------- /01_product_problems/problem_113.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Honey. 2 | 3 | Tell me about a product you really like. 4 | 5 | For this problem we'll be using LinkedIn. 6 | 7 | Make it harder? Follow along and use LinkedIn as your answer. -------------------------------------------------------------------------------- /01_product_problems/problem_114.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Dropbox. 2 | 3 | What would you do if you found out our uploads were down 50%? 4 | 5 | Make it harder? Uploads have only changed on web. -------------------------------------------------------------------------------- /01_product_problems/problem_115.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Google. 2 | 3 | If you were the product manager on Calendars, how would you measure it's success? 4 | 5 | Make it harder? Evaluate at least three different user behaviors. -------------------------------------------------------------------------------- /01_product_problems/problem_116.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Dropbox. 2 | 3 | What's the difference between a POST and GET request? 4 | 5 | Make it harder? List at least 5 different endpoints. -------------------------------------------------------------------------------- /01_product_problems/problem_117.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Apple. 2 | 3 | How would you measure the success of our iPad Pro? 4 | 5 | Make it harder? Ask a friend to mock interview you with this! -------------------------------------------------------------------------------- /01_product_problems/problem_118.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Google. 2 | 3 | How many grains of rice are in a 10kg bag? 4 | 5 | Make it harder? Answer in under five minutes! -------------------------------------------------------------------------------- /01_product_problems/problem_119.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Wealthsimple. 2 | 3 | Assume we had a 25% drop in conversion on our landing page. What would you do? 4 | 5 | Make it harder? Use this question for a mock interview! -------------------------------------------------------------------------------- /01_product_problems/problem_12.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Microsoft. 2 | 3 | Facebook bought Instagram for about $1B, even though Instagram was making no money. Why do you think Facebook did this? 4 | 5 | Make it harder? Provide at least three unique reasons why the acquisition was made. -------------------------------------------------------------------------------- /01_product_problems/problem_120.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Discord. 2 | 3 | How would you improve Discord? 4 | 5 | Make it harder? Offer at least two unique improvements. -------------------------------------------------------------------------------- /01_product_problems/problem_121.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Twilio. 2 | 3 | Why do you think we acquired SendGrid? 4 | 5 | Make it harder? Evaluate at least three different reasons. -------------------------------------------------------------------------------- /01_product_problems/problem_122.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Disney. 2 | 3 | How would you diagnose a 15% drop in active users on Disney+? 4 | 5 | Make it harder? Ask one of your friends to mock you with this question! -------------------------------------------------------------------------------- /01_product_problems/problem_123.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by LinkedIn. 2 | 3 | How do you think our Jobs feature is tracked? 4 | 5 | Make it harder? Evaluate at least five different user behaviors. -------------------------------------------------------------------------------- /01_product_problems/problem_124.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Lyft. 2 | 3 | What's your favorite product and why? 4 | 5 | For this problem we'll be using Messenger. 6 | 7 | Make it harder? Follow along and use Messenger as your answer. -------------------------------------------------------------------------------- /01_product_problems/problem_125.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Amazon. 2 | 3 | How many pairs of shoes do you think we go through in our lifetime? 4 | 5 | Make it harder? Account for different age ranges. -------------------------------------------------------------------------------- /01_product_problems/problem_126.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Google. 2 | 3 | Searches are down 35%. What happened? 4 | 5 | Make it harder? Uploads have only changed on web uploads. -------------------------------------------------------------------------------- /01_product_problems/problem_127.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Netflix. 2 | 3 | What are our risks if we wanted to expand into China? 4 | 5 | Make it harder? Evaluate at least three different risks. -------------------------------------------------------------------------------- /01_product_problems/problem_128.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Apple. 2 | 3 | How would you improve the Apple Watch? 4 | 5 | Make it harder? Offer at least two unique improvements. -------------------------------------------------------------------------------- /01_product_problems/problem_129.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Hoop. 2 | 3 | If you were the product manager in charge of expanding into South America, how would you do it? 4 | 5 | Make it harder? Ask a friend to give you a mock interview with this question! -------------------------------------------------------------------------------- /01_product_problems/problem_13.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Yelp. 2 | 3 | We're always looking for ways to improve our app experience for our users. Based on your research, how would you improve Yelp? 4 | 5 | Make it harder? Use data to validate your solution. -------------------------------------------------------------------------------- /01_product_problems/problem_130.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Amazon. 2 | 3 | List an example of one endpoint on Twitch. What does it do? 4 | 5 | Make it harder? Answer in five sentences or less. -------------------------------------------------------------------------------- /01_product_problems/problem_131.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Intuit. 2 | 3 | One of our most successful products is TurboTax. How would you measure the metrics on it if you were the product manager in charge? 4 | 5 | Make it harder? Evaluate at least three different user behaviors. -------------------------------------------------------------------------------- /01_product_problems/problem_132.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Deliveroo. 2 | 3 | If you were the product manager in charge of expansions and we wanted to go to the US. How would you do it? 4 | 5 | Make it harder? Ask a friend to give you a mock interview with this question! -------------------------------------------------------------------------------- /01_product_problems/problem_133.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Snapchat. 2 | 3 | We have been trying to strengthen our APAC presence lately. How would you help us continue to expand in Indonesia? 4 | 5 | Make it harder? Provide at least five different channels that Snapchat could use. -------------------------------------------------------------------------------- /01_product_problems/problem_134.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Shopify. 2 | 3 | What's your biggest weakness? 4 | 5 | Make it harder? Use being too detail oriented. -------------------------------------------------------------------------------- /01_product_problems/problem_135.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Facebook. 2 | 3 | Go into detail about our signup endpoint. What does it do and what information does it require? 4 | 5 | Make it harder? List out as much detail as you can! -------------------------------------------------------------------------------- /01_product_problems/problem_136.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Salesforce. 2 | 3 | Why do you think we acquired Tableau? 4 | 5 | Make it harder? Evaluate at least three different reasons. -------------------------------------------------------------------------------- /01_product_problems/problem_137.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Facebook. 2 | 3 | How many people do you think are on Facebook at any given time? 4 | 5 | Make it harder? Answer in under 5 minutes! -------------------------------------------------------------------------------- /01_product_problems/problem_138.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Stripe. 2 | 3 | What improvements would you make to our product? 4 | 5 | Make it harder? Ask a friend to mock you with this question! -------------------------------------------------------------------------------- /01_product_problems/problem_139.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Uber. 2 | 3 | Tell me about your favorite product. 4 | 5 | For this problem we'll be using Notion. 6 | 7 | Make it harder? Follow along and use Notion as your answer. -------------------------------------------------------------------------------- /01_product_problems/problem_14.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Stripe. 2 | 3 | One app I use everyday is Spotify. Provide five different examples of APIs they may have. 4 | 5 | Make it harder? Provide your answer in under one minute. 6 | -------------------------------------------------------------------------------- /01_product_problems/problem_140.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Apple. 2 | 3 | How do you think the 2019 US-China trade war affects our company? 4 | 5 | Make it harder? Propose at least three different ways Apple is affected. -------------------------------------------------------------------------------- /01_product_problems/problem_141.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Twitter. 2 | 3 | Why do you want to work here? 4 | 5 | Make it harder? Assume you applied for a role in their Ads division. -------------------------------------------------------------------------------- /01_product_problems/problem_142.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by LinkedIn. 2 | 3 | Assume we had a significant drop in our iOS installs. What would you do? 4 | 5 | Make it harder? Uploads have only changed on web. -------------------------------------------------------------------------------- /01_product_problems/problem_143.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Yelp. 2 | 3 | How do you think we track our product's success? 4 | 5 | Make it harder? Evaluate at least three different user behaviors. -------------------------------------------------------------------------------- /01_product_problems/problem_144.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Twitch. 2 | 3 | List a few improvements for any product. 4 | 5 | We'll be using Evernote for this example. 6 | 7 | Make it harder? Offer at least three unique improvements. -------------------------------------------------------------------------------- /01_product_problems/problem_145.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Instagram. 2 | 3 | What's your favorite consumer product? 4 | 5 | For this problem we'll be using the Apple Watch. 6 | 7 | Make it harder? Follow along and use the Apple Watch as your answer. -------------------------------------------------------------------------------- /01_product_problems/problem_146.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Intercom. 2 | 3 | What's the benefit of A/B testing for product organizations? 4 | 5 | Make it harder? List at least three different reasons. -------------------------------------------------------------------------------- /01_product_problems/problem_147.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Twitch. 2 | 3 | How many weddings does the average American attend in their lifetime? 4 | 5 | Make it harder? Account for divorces and remarrying. -------------------------------------------------------------------------------- /01_product_problems/problem_148.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Netflix. 2 | 3 | How would you go about expanding into China? 4 | 5 | Make it harder? Evaluate at least five different channels Netflix could use. -------------------------------------------------------------------------------- /01_product_problems/problem_149.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Facebook. 2 | 3 | Why do you think we made the Portal? 4 | 5 | Make it harder? Propose at least three unique reasons. -------------------------------------------------------------------------------- /01_product_problems/problem_15.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Yelp. 2 | 3 | One of the main activities for anyone here is lunch. We occasionally have catered lunches and we have a bar/cafe that provides drinks. However, one big problem is waiting in lines for these lunches can be long. Design a product that would help Yelp engineers pick up their catered lunch without having to line up. 4 | 5 | Make it harder? Whiteboard your solution. -------------------------------------------------------------------------------- /01_product_problems/problem_150.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Google. 2 | 3 | Estimate the number of Instagram posts per day. 4 | 5 | Make it harder? Provide a sanity check before concluding. -------------------------------------------------------------------------------- /01_product_problems/problem_151.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Uber. 2 | 3 | Uber Eats has become one of our core revenue drivers. What is one thing you'd do to improve the experience? 4 | 5 | Make it harder? Offer at least three unique improvements. -------------------------------------------------------------------------------- /01_product_problems/problem_152.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Facebook. 2 | 3 | Design a web app to find a cleaner. 4 | 5 | Make it harder? Whiteboard your solution! -------------------------------------------------------------------------------- /01_product_problems/problem_153.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Google. 2 | 3 | Day One is my favorite journaling app. How would you improve it? 4 | 5 | Make it harder? Offer at least one small improvement and one big improvement. -------------------------------------------------------------------------------- /01_product_problems/problem_154.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Microsoft. 2 | 3 | What's your favorite subscription-based product? 4 | 5 | For this problem we'll be using Amazon Prime. 6 | 7 | Make it harder? Follow along and use Amazon Prime as your answer. -------------------------------------------------------------------------------- /01_product_problems/problem_155.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Uber. 2 | 3 | Estimate how many rides you think happen on our app each month. 4 | 5 | Make it harder? Provide a sanity check before concluding. -------------------------------------------------------------------------------- /01_product_problems/problem_156.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Rover. 2 | 3 | Design a better dog bowl. 4 | 5 | Make it harder? Consider both user and customer. -------------------------------------------------------------------------------- /01_product_problems/problem_157.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Apple. 2 | 3 | Design a water bottle. 4 | 5 | Make it harder? Assume they're for office workers. -------------------------------------------------------------------------------- /01_product_problems/problem_158.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by HelloFresh. 2 | 3 | We're nearing the end of quarantine due to COVID-19. How do you think it affected us as a business? 4 | 5 | Make it harder? Evaluate at least three different reasons. -------------------------------------------------------------------------------- /01_product_problems/problem_159.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Spotify. 2 | 3 | How many people are streaming music on Spotify right now? 4 | 5 | Make it harder? Provide a sanity check before concluding. -------------------------------------------------------------------------------- /01_product_problems/problem_16.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Airbnb. 2 | 3 | What do you like about our product? 4 | 5 | Make it harder? Provide two improvements with your answer. -------------------------------------------------------------------------------- /01_product_problems/problem_160.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Tinder. 2 | 3 | What are four endpoints we might have on our app? 4 | 5 | Make it harder? For each endpoint, define what type of requests they are. 6 | -------------------------------------------------------------------------------- /01_product_problems/problem_161.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by edX. 2 | 3 | I always like to see how technical interviewees are. Can you list three endpoints on our web app? 4 | 5 | Make it harder? List out as much detail as you can! -------------------------------------------------------------------------------- /01_product_problems/problem_162.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Drop. 2 | 3 | What's your biggest strength? 4 | 5 | Make it harder? Use attention to detail as your strength. -------------------------------------------------------------------------------- /01_product_problems/problem_163.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Facebook. 2 | 3 | One thing we're really proud of is GraphQL. Based on your technical knowledge, can you tell me one advantage and one disadvantage of GraphQL? 4 | 5 | Make it harder? List out as much detail as you can! -------------------------------------------------------------------------------- /01_product_problems/problem_164.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Slack. 2 | 3 | Why do you want to work here? 4 | 5 | Make it harder? Provide at least three distinct reasons. -------------------------------------------------------------------------------- /01_product_problems/problem_165.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Airtable. 2 | 3 | What's your favorite product? 4 | 5 | For this problem we'll be using Stripe. 6 | 7 | Make it harder? Follow along and use Stripe as your answer. -------------------------------------------------------------------------------- /01_product_problems/problem_166.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Invision. 2 | 3 | Assume usage on our web app is down 35% - why do you think that might have happened? 4 | 5 | Make it harder? Revenue is also down. -------------------------------------------------------------------------------- /01_product_problems/problem_167.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Uber. 2 | 3 | Let's say we decided to add a promos tab to our app, how would you measure it's success? 4 | 5 | Make it harder? Analyze core behaviors. -------------------------------------------------------------------------------- /01_product_problems/problem_168.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by HelloFresh. 2 | 3 | What's your biggest strength? 4 | 5 | Make it harder? Use being a great team player. -------------------------------------------------------------------------------- /01_product_problems/problem_169.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Instagram. 2 | 3 | Estimate the number of likes on Instagram posts per day. 4 | 5 | Make it harder? Provide a sanity check before concluding. -------------------------------------------------------------------------------- /01_product_problems/problem_17.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Lyft. 2 | 3 | Let's say we hired you to start the coming January and during your first month you notice there's a 45% drop in ride orders. What are your next steps? 4 | 5 | Make it harder? The drop is regionally restricted to East Coast American cities. -------------------------------------------------------------------------------- /01_product_problems/problem_170.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Google. 2 | 3 | Imagine that you are a PM at Intercom, and you were in charge of building a new feature allowing customers to interact with their leads over SMS. How would you measure it's success? 4 | 5 | Make it harder? Analyze core behaviors. -------------------------------------------------------------------------------- /01_product_problems/problem_171.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Google. 2 | 3 | What happens, technically, when someone does a Google Search? 4 | 5 | Make it harder? List out at least five different steps in the process. -------------------------------------------------------------------------------- /01_product_problems/problem_172.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Uber. 2 | 3 | How do you think COVID-19 impacted us? 4 | 5 | Make it harder? Evaluate at least three different reasons. -------------------------------------------------------------------------------- /01_product_problems/problem_173.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Amazon. 2 | 3 | Assume Amazon orders are down 25%. In this scenario, what are your next steps? 4 | 5 | Make it harder? The drop occurred over a two week period. -------------------------------------------------------------------------------- /01_product_problems/problem_174.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Airbnb. 2 | 3 | I love learning, and EdX has become one of my favorite tools for self-learning at home. How would you measure the success of their search bar? 4 | 5 | Make it harder? Evaluate at least three different behaviors. -------------------------------------------------------------------------------- /01_product_problems/problem_175.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Google. 2 | 3 | Imagine that you are a PM at Discord, and you were tasked with building out a marketplace allowing users to buy games directly through their client. How would you measure it's success? 4 | 5 | Make it harder? Consider marketplace dynamics in your questioning. -------------------------------------------------------------------------------- /01_product_problems/problem_176.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Google. 2 | 3 | Estimate the number of breaths we take. 4 | 5 | Make it harder? Consider at least two edge cases to your base formula. -------------------------------------------------------------------------------- /01_product_problems/problem_177.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Shopify. 2 | 3 | What's your favorite e-commerce store? 4 | 5 | For this problem we'll be using Sephora. 6 | 7 | Make it harder? Follow along and use Sephora as your answer. -------------------------------------------------------------------------------- /01_product_problems/problem_178.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Facebook. 2 | 3 | Since the quarantine, a lot of us have been stuck at home and reliant on Zoom for work and socialization. How would you improve it? 4 | 5 | Make it harder? Offer at least one small improvement and one big improvement. -------------------------------------------------------------------------------- /01_product_problems/problem_179.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Top Hat. 2 | 3 | As a gamer, I love using Discord. Assume you were a PM on their team and their installs were down 25%. What would you do? 4 | 5 | Make it harder? Assume installs are down on all platforms. -------------------------------------------------------------------------------- /01_product_problems/problem_18.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Pinterest. 2 | 3 | Briefly describe why you think Google acquired YouTube. 4 | 5 | Make it harder? Provide at least three unique reasons why the acquisition was made. -------------------------------------------------------------------------------- /01_product_problems/problem_180.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Airbnb. 2 | 3 | What's an app you use every day? Why do you like it? 4 | 5 | For this problem we'll be using Google Calendar. 6 | 7 | Make it harder? Follow along and use Google Calendar as your answer. -------------------------------------------------------------------------------- /01_product_problems/problem_181.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Facebook. 2 | 3 | Think of different types of subscription services - design one of your choice. 4 | 5 | Make it harder? Choose a product with a physical component. -------------------------------------------------------------------------------- /01_product_problems/problem_182.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Opencare. 2 | 3 | What's your biggest weakness? 4 | 5 | Make it harder? Use being careless as your weakness. -------------------------------------------------------------------------------- /01_product_problems/problem_183.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Twitch. 2 | 3 | What's your biggest strength? 4 | 5 | Make it harder? Use your ability to communicate cross-functionally as your strength. -------------------------------------------------------------------------------- /01_product_problems/problem_184.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Apple. 2 | 3 | How would you measure the success of our AirPods Pro? 4 | 5 | Make it harder? Analyze core behaviors. -------------------------------------------------------------------------------- /01_product_problems/problem_185.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Samsung. 2 | 3 | One of my favorite publications is The New Yorker. Let's say you were a PM on their digital team and you noticed online orders were down 30%. Figure out why. 4 | 5 | Make it harder? Orders dropped rapidly. -------------------------------------------------------------------------------- /01_product_problems/problem_186.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Yelp. 2 | 3 | What's your favorite consumer product? Please don't use Yelp. 4 | 5 | For this problem we'll be using Discord. 6 | 7 | Make it harder? Follow along and use Discord as your answer. -------------------------------------------------------------------------------- /01_product_problems/problem_187.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by theScore. 2 | 3 | You won't need to know how to code, but it'll be useful if you can empathize with developers. What are three endpoints we might have on our sports app? 4 | 5 | Make it harder? List out at least one POST request and one GET request. -------------------------------------------------------------------------------- /01_product_problems/problem_188.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Spotify. 2 | 3 | What are the biggest ways COVID-19 affected us? 4 | 5 | Make it harder? Evaluate at least three different reasons. -------------------------------------------------------------------------------- /01_product_problems/problem_189.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Amazon. 2 | 3 | How do you think Amazon was affected by COVID-19? 4 | 5 | Make it harder? Evaluate at least three different reasons. -------------------------------------------------------------------------------- /01_product_problems/problem_19.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Facebook. 2 | 3 | We try to add more socially responsible features to help the community. One that is quite popular is our Crisis Alert feature. How would you improve it? 4 | 5 | Make it harder? Provide at least three improvements -------------------------------------------------------------------------------- /01_product_problems/problem_190.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Facebook. 2 | 3 | Houseparty is a pretty popular app nowadays since quarantine began. What would you do to improve it? 4 | 5 | Make it harder? Offer at least one small improvement and one big improvement. -------------------------------------------------------------------------------- /01_product_problems/problem_191.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Facebook. 2 | 3 | Let's say event creates were down 100% on our app. Why do you think that might have happened? 4 | 5 | Make it harder? Gather context from at least six different categories. -------------------------------------------------------------------------------- /01_product_problems/problem_192.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Amazon. 2 | 3 | Our tracking page is one of our most viewed pages post-purchase. How would you improve it? 4 | 5 | Make it harder? Offer at least one small improvement and one big improvement. -------------------------------------------------------------------------------- /01_product_problems/problem_193.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Walmart. 2 | 3 | Design the best slippers. 4 | 5 | Make it harder? Assume they're for everyday wearers. -------------------------------------------------------------------------------- /01_product_problems/problem_194.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Facebook. 2 | 3 | I think quarantine from COVID-19 has taught us as a company a lot. What are ways we could improve how we operate internally if another pandemic struck? 4 | 5 | Make it harder? Evaluate at least three different reasons. -------------------------------------------------------------------------------- /01_product_problems/problem_195.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Facebook. 2 | 3 | Estimate the number of likes on Facebook posts per day. 4 | 5 | Make it harder? Provide a sanity check before concluding. -------------------------------------------------------------------------------- /01_product_problems/problem_196.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Yelp. 2 | 3 | Our search tool is our most used feature - how would you measure it's success? 4 | 5 | Make it harder? Evaluate at least three different behaviors. -------------------------------------------------------------------------------- /01_product_problems/problem_197.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Notion. 2 | 3 | How would you find out what caused a 25% decrease in conversion? 4 | 5 | Make it harder? Mobile conversion dropped more than web conversion. -------------------------------------------------------------------------------- /01_product_problems/problem_198.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Apple. 2 | 3 | How do you think Tesla measured the success of the Cybertruck announcement? 4 | 5 | Make it harder? Evaluate at least three different behaviors. -------------------------------------------------------------------------------- /01_product_problems/problem_199.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Spotify. 2 | 3 | How would you find out what caused a 25% decrease in song listens? 4 | 5 | Make it harder? Assume conversion is down across the industry. -------------------------------------------------------------------------------- /01_product_problems/problem_2.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Amazon. 2 | 3 | How would you explain the difference between an API and SDK to a non-technical person? 4 | 5 | Make it harder? Explain it in less than 3 sentences. -------------------------------------------------------------------------------- /01_product_problems/problem_20.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by LinkedIn. 2 | 3 | What's an endpoint? Give an example of one POST request and one GET request we'd likely have here at LinkedIn. 4 | 5 | Make it harder? Provide your answer in under one minute. -------------------------------------------------------------------------------- /01_product_problems/problem_200.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by HelloFresh. 2 | 3 | Let's say our meal kit first month churn increased by 40%. What would you do? 4 | 5 | Make it harder? Assume conversion is down across the industry. -------------------------------------------------------------------------------- /01_product_problems/problem_201.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Yelp. 2 | 3 | Tell me about yourself. 4 | 5 | Make it harder? State your answer in under 2 minutes. -------------------------------------------------------------------------------- /01_product_problems/problem_202.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Facebook. 2 | 3 | Design any app that makes you happier. 4 | 5 | Make it harder? Build a mobile app. -------------------------------------------------------------------------------- /01_product_problems/problem_203.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Amazon. 2 | 3 | Why do you think Amazon started out by selling just books? 4 | 5 | Make it harder? Provide three reasons for your selection. -------------------------------------------------------------------------------- /01_product_problems/problem_204.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Facebook. 2 | 3 | What do you think was our best acquisition? 4 | 5 | Make it harder? Provide three reasons for your selection. -------------------------------------------------------------------------------- /01_product_problems/problem_205.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Disney. 2 | 3 | Continually learning is a common theme for our product team. One way we do that is by listening to inspirational speakers online through TED Talks. How would you improve TED? 4 | 5 | Make it harder? Focus on web improvements. -------------------------------------------------------------------------------- /01_product_problems/problem_206.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Wayfair. 2 | 3 | What are three endpoints on our web app? 4 | 5 | Make it harder? List out at least one POST request and one GET request. -------------------------------------------------------------------------------- /01_product_problems/problem_207.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Tesla. 2 | 3 | What's your favorite physical product? 4 | 5 | For this problem we'll be using the Vankyo Projector. 6 | 7 | Make it harder? Follow along and use the Vankyo Projector as your answer. -------------------------------------------------------------------------------- /01_product_problems/problem_208.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Google. 2 | 3 | Design a cereal dispenser. 4 | 5 | Make it harder? Build for those over the age of 65. -------------------------------------------------------------------------------- /01_product_problems/problem_209.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Top Hat. 2 | 3 | List three endpoints we have on our digital classroom product. 4 | 5 | Make it harder? List out at least one POST request and one GET request. -------------------------------------------------------------------------------- /01_product_problems/problem_21.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Instagram. 2 | 3 | How would you evaluate the success of Instagram Stories? 4 | 5 | Make it harder? List at least five different metrics you'd look at. -------------------------------------------------------------------------------- /01_product_problems/problem_210.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Discord. 2 | 3 | What are three endpoints on our app? 4 | 5 | Make it harder? List out at least one POST request and one GET request. -------------------------------------------------------------------------------- /01_product_problems/problem_211.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Apple. 2 | 3 | If you were the product manager for FaceTime, how would you measure it's success? 4 | 5 | Make it harder? Evaluate at least three different behaviors. -------------------------------------------------------------------------------- /01_product_problems/problem_212.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Spotify. 2 | 3 | Patreon is an extremely popular subscription based app nowadays. How would you improve it? 4 | 5 | Make it harder? Offer at least one small improvement and one big improvement. -------------------------------------------------------------------------------- /01_product_problems/problem_213.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Wayfair. 2 | 3 | What's your favorite marketplace app besides Wayfair? 4 | 5 | For this problem we'll be using Ritual. 6 | 7 | Make it harder? Follow along and use Ritual as your answer. -------------------------------------------------------------------------------- /01_product_problems/problem_214.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Google. 2 | 3 | How many chickens are there in the world? 4 | 5 | Make it harder? Provide a sanity check before concluding. 6 | -------------------------------------------------------------------------------- /01_product_problems/problem_215.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by SendGrid. 2 | 3 | How would you diagnose a 35% drop in email opens from SendGrid? 4 | 5 | Make it harder? Assume all other metrics remain consistent. -------------------------------------------------------------------------------- /01_product_problems/problem_216.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Vogue. 2 | 3 | How would you improve the popular fashion marketplace, SSENSE? 4 | 5 | Make it harder? Offer at least one small improvement and one big improvement. -------------------------------------------------------------------------------- /01_product_problems/problem_217.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Opencare. 2 | 3 | How would you find out what caused a 25% decrease in conversion? 4 | 5 | Make it harder? Assume conversion is down across the industry. -------------------------------------------------------------------------------- /01_product_problems/problem_218.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Salesforce. 2 | 3 | Tell me about yourself. 4 | 5 | Make it harder? State your answer in under 2 minutes. -------------------------------------------------------------------------------- /01_product_problems/problem_219.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Disney. 2 | 3 | What's your favorite product? 4 | 5 | For this problem we'll be using Patreon. 6 | 7 | Make it harder? Follow along and use Patreon as your answer. -------------------------------------------------------------------------------- /01_product_problems/problem_22.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Microsoft. 2 | 3 | Microsoft bought LinkedIn for 26 billion dollars in 2016, even though they had a net loss of $166 million the last year. What was the reasoning for the purchase? 4 | 5 | Make it harder? Provide at least three different reasons. -------------------------------------------------------------------------------- /01_product_problems/problem_220.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Microsoft. 2 | 3 | How many messages are sent on Slack each day? 4 | 5 | Make it harder? Provide a sanity check before concluding. -------------------------------------------------------------------------------- /01_product_problems/problem_221.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by StickerGiant. 2 | 3 | How do you think we measure the success of our web pages? 4 | 5 | Make it harder? Evaluate at least three different behaviors. -------------------------------------------------------------------------------- /01_product_problems/problem_222.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Facebook. 2 | 3 | Tell me about yourself. 4 | 5 | Make it harder? State your answer in under 2 minutes. -------------------------------------------------------------------------------- /01_product_problems/problem_223.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Uber. 2 | 3 | How many deliveries do you think our Eats team handles each day? 4 | 5 | Make it harder? Answer in under six minutes. -------------------------------------------------------------------------------- /01_product_problems/problem_224.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Snapchat. 2 | 3 | TikTok was recently banned in India and some are lobbying for it's removal in America as well. What do you think should happen? 4 | 5 | Make it harder? Provide three reasons for your selection. -------------------------------------------------------------------------------- /01_product_problems/problem_225.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Shopify. 2 | 3 | Design a new Shopify App. 4 | 5 | Make it harder? Build an app around payments. -------------------------------------------------------------------------------- /01_product_problems/problem_226.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Instagram. 2 | 3 | TikTok is becoming one of the biggest social apps in the world. How would you monetize it? 4 | 5 | Make it harder? Provide 2 different monetization strategies. -------------------------------------------------------------------------------- /01_product_problems/problem_227.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Google. 2 | 3 | How many bottles of wine are opened per day? 4 | 5 | Make it harder? Provide a sanity check before concluding. -------------------------------------------------------------------------------- /01_product_problems/problem_228.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Google. 2 | 3 | How many phone calls are received per day? 4 | 5 | Make it harder? Provide a sanity check before concluding. -------------------------------------------------------------------------------- /01_product_problems/problem_229.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Samsung. 2 | 3 | Design a smart picture frame. 4 | 5 | Make it harder? Assume they're for the tech-savvy millennial. -------------------------------------------------------------------------------- /01_product_problems/problem_23.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Stripe. 2 | 3 | What's your favorite enterprise product, besides Stripe, you use at your current job? Why do you like it? 4 | 5 | For this problem we'll be using Confluence. 6 | 7 | Make it harder? Explain your solution in under 7 minutes. -------------------------------------------------------------------------------- /01_product_problems/problem_230.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by LinkedIn. 2 | 3 | You mentioned you had a dog earlier, so you must be familiar with Rover - how would you improve it? 4 | 5 | Make it harder? Focus on supply side improvements. -------------------------------------------------------------------------------- /01_product_problems/problem_231.txt: -------------------------------------------------------------------------------- 1 | How many phone calls are received per day? 2 | 3 | Make it harder? Provide a sanity check before concluding. -------------------------------------------------------------------------------- /01_product_problems/problem_232.txt: -------------------------------------------------------------------------------- 1 | You mentioned you had a dog earlier, so you must be familiar with Rover - how would you improve it? 2 | 3 | Make it harder? Focus on supply side improvements. -------------------------------------------------------------------------------- /01_product_problems/problem_233.txt: -------------------------------------------------------------------------------- 1 | How would you measure the success of Google Drive's upload feature? 2 | 3 | Make it harder? Evaluate at least three different behaviors. -------------------------------------------------------------------------------- /01_product_problems/problem_234.txt: -------------------------------------------------------------------------------- 1 | What are three endpoints on YouTube? 2 | 3 | Make it harder? List out at least one POST request and one GET request. -------------------------------------------------------------------------------- /01_product_problems/problem_235.txt: -------------------------------------------------------------------------------- 1 | How would you improve StubHub? 2 | 3 | Make it harder? Offer at least one small improvement and one big improvement. -------------------------------------------------------------------------------- /01_product_problems/problem_236.txt: -------------------------------------------------------------------------------- 1 | Facebook has made a lot of acquisitions to became a powerhouse in the tech space. Are there any other verticals or acquisitions you think they should look into? 2 | 3 | Make it harder? Provide three reasons for your selection. -------------------------------------------------------------------------------- /01_product_problems/problem_237.txt: -------------------------------------------------------------------------------- 1 | What's your favorite product? 2 | 3 | For this problem we'll be using Kickstarter. 4 | 5 | Make it harder? Follow along and use Kickstarter as your answer. -------------------------------------------------------------------------------- /01_product_problems/problem_238.txt: -------------------------------------------------------------------------------- 1 | Why do you want to work at Atlassian? 2 | 3 | Make it harder? Provide at least three distinct reasons. -------------------------------------------------------------------------------- /01_product_problems/problem_239.txt: -------------------------------------------------------------------------------- 1 | Go into detail about what happens when a user logs in to an app. 2 | 3 | Make it harder? List at least five specific steps. -------------------------------------------------------------------------------- /01_product_problems/problem_240.txt: -------------------------------------------------------------------------------- 1 | Why do you want to work at PayPal? 2 | 3 | Make it harder? Provide at least three distinct reasons. -------------------------------------------------------------------------------- /01_product_problems/problem_241.txt: -------------------------------------------------------------------------------- 1 | What's your favorite enterprise app? Please don't use HubSpot. 2 | 3 | For this problem we'll be using Google Analyticsl. 4 | 5 | Make it harder? Follow along and use Google Analytics as your answer. -------------------------------------------------------------------------------- /01_product_problems/problem_242.txt: -------------------------------------------------------------------------------- 1 | Design a web app for office workers to book time off. 2 | 3 | Make it harder? Whiteboard your solution! -------------------------------------------------------------------------------- /01_product_problems/problem_243.txt: -------------------------------------------------------------------------------- 1 | We're always looking for ways to improve our app experience for our users. Based on your research, how would you improve Yelp? 2 | 3 | Make it harder? Use data to validate your solution. -------------------------------------------------------------------------------- /01_product_problems/problem_244.txt: -------------------------------------------------------------------------------- 1 | One of the main activities for anyone here is lunch. We occasionally have catered lunches and we have a bar/cafe that provides drinks. However, one big problem is waiting in lines for these lunches can be long. Design a product that would help Yelp engineers pick up their catered lunch without having to line up. 2 | 3 | Make it harder? Whiteboard your solution. -------------------------------------------------------------------------------- /01_product_problems/problem_245.txt: -------------------------------------------------------------------------------- 1 | Estimate Facebook's yearly ad revenue? 2 | 3 | Make it harder? Come up with two unique ways to estimate ad revenue -------------------------------------------------------------------------------- /01_product_problems/problem_246.txt: -------------------------------------------------------------------------------- 1 | Design a better elevator. 2 | 3 | Make it harder? The elevator is used for heavy machinery in industrial settings. -------------------------------------------------------------------------------- /01_product_problems/problem_247.txt: -------------------------------------------------------------------------------- 1 | Uber Eats has become one of our premier offerings. How do you think we track it's success? 2 | 3 | Make it harder? Do this question twice: first measure the success on the consumer side, and then measure the success on the business side. -------------------------------------------------------------------------------- /01_product_problems/problem_248.txt: -------------------------------------------------------------------------------- 1 | What's your favorite non-tech product that you use frequently? 2 | 3 | For this problem we'll be using Inflatable Travel Pillows. 4 | 5 | Make it harder? Provide at least one improvement to this product. -------------------------------------------------------------------------------- /01_product_problems/problem_249.txt: -------------------------------------------------------------------------------- 1 | Let's say App Store usage dropped 30%. What would you do? 2 | 3 | Make it harder? The drop happens the month after the new iPhone launched. -------------------------------------------------------------------------------- /01_product_problems/problem_25.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Google. 2 | 3 | Estimate the total number of videos on Youtube. 4 | 5 | Make it harder? Account for growth of video uploads as Youtube becomes more popular. -------------------------------------------------------------------------------- /01_product_problems/problem_250.txt: -------------------------------------------------------------------------------- 1 | Explain statistical significance and why it's important. 2 | 3 | Make it harder? Say your answer out loud - do so in under 1 minute. -------------------------------------------------------------------------------- /01_product_problems/problem_26.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Uber. 2 | 3 | Why is display advertising a bad decision? 4 | 5 | Make it harder? Propose a better option than display ads. -------------------------------------------------------------------------------- /01_product_problems/problem_27.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Facebook. 2 | 3 | Usage on Facebook Events is down 10%. What do you do? 4 | 5 | Make it harder? The drop is due to cannibalization from other Facebook products and features. -------------------------------------------------------------------------------- /01_product_problems/problem_28.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Slack. 2 | 3 | What would you track here to measure our success? 4 | 5 | Make it harder? Use user behavior to prioritize metrics. -------------------------------------------------------------------------------- /01_product_problems/problem_29.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Spotify. 2 | 3 | Let's say we hired you to solve one problem we're facing for you as a user. What would you implement? 4 | 5 | Make it harder? Assume you primarily use Spotify while driving. -------------------------------------------------------------------------------- /01_product_problems/problem_3.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Google. 2 | 3 | You're the new product manager for YouTube and you notice a drop in video engagement by 15% over the past two weeks. What do you do? 4 | 5 | Make it harder? The drop in engagement is globally distributed. -------------------------------------------------------------------------------- /01_product_problems/problem_30.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Apple. 2 | 3 | Design a bookshelf. 4 | 5 | Make it harder? Whiteboard your solution. 6 | -------------------------------------------------------------------------------- /01_product_problems/problem_31.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Asana. 2 | 3 | What's a tool you think other product managers should use? 4 | 5 | For this problem we'll be using Balsamiq, a wireframing app. 6 | 7 | Make it harder? Time yourself. Be succinct: between 5 and 7 minutes. -------------------------------------------------------------------------------- /01_product_problems/problem_32.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Uber Eats. 2 | 3 | A couple of years ago Yelp sold off their Eat24 product and saw their stock jump a considerable amount. Why do you think this happened? 4 | 5 | Make it harder? Provide at least three different reasons -------------------------------------------------------------------------------- /01_product_problems/problem_33.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Facebook. 2 | 3 | How much money does Facebook make in ads every year? 4 | 5 | Make it harder? Come up with two unique ways to estimate ad revenue -------------------------------------------------------------------------------- /01_product_problems/problem_34.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Oculus. 2 | 3 | The first thing Oculus users experience when they put on their headset is the Oculus Home. We recently upgraded to Home 2.0 which features more immersion and personalization. How else would you improve the Home 2.0 if you were a PM at Oculus? 4 | 5 | Make it harder? Provide at least two improvements. -------------------------------------------------------------------------------- /01_product_problems/problem_35.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Google. 2 | 3 | What is the most important metric for Google Docs and why? 4 | 5 | Make it harder? Rank at least 5 different metrics. -------------------------------------------------------------------------------- /01_product_problems/problem_36.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Spotify. 2 | 3 | Conversion on our landing page dropped by 25% last week. How would you diagnose what happened? 4 | 5 | Make it harder? The drop is sudden. -------------------------------------------------------------------------------- /01_product_problems/problem_37.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Yelp. 2 | 3 | Yelp is trying to enter into the Asian market and you're the PM on the expansion team. How would you figure out growth in that market? 4 | 5 | Make it harder? Prioritize at least 6 different growth channels. -------------------------------------------------------------------------------- /01_product_problems/problem_38.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Google. 2 | 3 | Describe what happens when you type a URL into your browser and press Enter. 4 | 5 | Make it harder? Provide a comprehensive answer covering DNS Lookup, request handling, and rendering. -------------------------------------------------------------------------------- /01_product_problems/problem_39.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Invision. 2 | 3 | Since we're a completely remote team, it's an understatement to say we use a lot of collaboration tools. What's a collaboration product your teams use and why do you like it? 4 | 5 | For this problem we'll be using Slack. 6 | 7 | Make it harder? Include at least two alternatives to your product and talk about why yours is superior. -------------------------------------------------------------------------------- /01_product_problems/problem_4.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Facebook. 2 | 3 | Assume you were hired as a product manager at Facebook and you were in charge of Facebook Stories. How would you measure the success of the feature? 4 | 5 | Make it harder? Whiteboard your solution. -------------------------------------------------------------------------------- /01_product_problems/problem_40.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Shopify. 2 | 3 | Design a better elevator. 4 | 5 | Make it harder? The elevator is used for heavy machinery in industrial settings. -------------------------------------------------------------------------------- /01_product_problems/problem_41.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Dropbox. 2 | 3 | How big is the market for Dropbox for SMBs? 4 | 5 | Make it harder? Consider up-sold items in your solution. -------------------------------------------------------------------------------- /01_product_problems/problem_42.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Uber. 2 | 3 | UberEats has become one of our premier offerings. How do you think we track it's success? 4 | 5 | Make it harder? Do this question twice: first measure the success on the consumer side, and then measure the success on the business side. -------------------------------------------------------------------------------- /01_product_problems/problem_43.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Disney. 2 | 3 | How would you improve how we serve content on ESPN? 4 | 5 | Make it harder? Assume you're improving the mobile app. -------------------------------------------------------------------------------- /01_product_problems/problem_44.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Salesforce. 2 | 3 | Let's say we had a 35% drop in retention on our Salesforce CRM. How would you figure out what to do next? 4 | 5 | Make it harder? The drop is predominantly companies in Germany, France, and Spain. -------------------------------------------------------------------------------- /01_product_problems/problem_45.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Microsoft. 2 | 3 | We bought GitHub for $7.5 billion in 2018. Name some reasons for the acquisition. 4 | 5 | Make it harder? Provide at least 3 separate reasons. -------------------------------------------------------------------------------- /01_product_problems/problem_46.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Affirm. 2 | 3 | Assume we have a classifier that produces a score between 0 and 1 for the probability of a particular loan application behind a fraud. Say that for each application’s score, we take the square root of that score. How would the ROC curve change? If it doesn’t change, what kinds of functions would change the curve? -------------------------------------------------------------------------------- /01_product_problems/problem_47.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Spotify. 2 | 3 | Estimate the bandwidth required to support our app. 4 | 5 | Make it harder? Estimate in petabytes per month. -------------------------------------------------------------------------------- /01_product_problems/problem_48.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Apple. 2 | 3 | What's your favorite non-tech product that you use frequently? 4 | 5 | For this problem we'll be using Inflatable Travel Pillows. 6 | 7 | Make it harder? Provide at least one improvement to this product. -------------------------------------------------------------------------------- /01_product_problems/problem_49.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Facebook. 2 | 3 | I love travelling and meeting new people. Sometimes, though, it's hard to communicate in countries that don't primarily speak English. Design a new way for tourists to communicate. 4 | 5 | Make it harder? Prioritize your feature set. -------------------------------------------------------------------------------- /01_product_problems/problem_5.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Uber. 2 | 3 | In your opinion, why do you think Amazon is buying retail companies and keeping them independent? 4 | 5 | Make it harder? Use specific examples of what Amazon has bought to better illustrate your point -------------------------------------------------------------------------------- /01_product_problems/problem_50.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Google. 2 | 3 | How would you improve Google Maps? 4 | 5 | Make it harder? Offer at least two big improvements. -------------------------------------------------------------------------------- /01_product_problems/problem_51.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Airbnb. 2 | 3 | What do you think are Airbnb's biggest risks? 4 | 5 | Make it harder? Name at least three and rank them. -------------------------------------------------------------------------------- /01_product_problems/problem_52.txt: -------------------------------------------------------------------------------- 1 | This problem was asked by Apple. 2 | 3 | Let's say App Store usage dropped 30%. What would you do? 4 | 5 | Make it harder? The drop happens the month after the new iPhone launched. -------------------------------------------------------------------------------- /01_product_problems/problem_53.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Instagram. 2 | 3 | Tell me about an app you use on your phone every day. Please don't use any Facebook products, including Instagram or WhatsApp. 4 | 5 | For this problem we'll be using Splitwise, a shared bill and expense tracking app. 6 | 7 | Make it harder? Time yourself. Be succinct: between 5 and 7 minutes. 8 | 9 | -------------------------------------------------------------------------------- /01_product_problems/problem_54.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Netflix. 2 | 3 | How would you measure the success of the recommendation engine at Netflix? 4 | 5 | Make it harder? Map at least 5 unique user behaviors. -------------------------------------------------------------------------------- /01_product_problems/problem_55.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by RealSelf. 2 | 3 | Let's say RealSelf selected South Korea as the next market to expand into. Walk me through your strategy. 4 | 5 | RealSelf is a healthcare marketplace where consumers research aesthetic treatments (plastic surgery, etc.) and connect with physicians. 6 | 7 | Make it harder? Your strategy should consider both supply and demand. -------------------------------------------------------------------------------- /01_product_problems/problem_57.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Yelp. 2 | 3 | What is the benefit of having a control group when testing? 4 | 5 | Make it harder? Give an example to help illustrate your point. -------------------------------------------------------------------------------- /01_product_problems/problem_58.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Amazon. 2 | 3 | What's your favorite product and why? 4 | 5 | For this problem we'll be using Netflix. 6 | 7 | Make it harder? Follow along and use Netflix as your answer. -------------------------------------------------------------------------------- /01_product_problems/problem_59.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Quora. 2 | 3 | Explain statistical significance and why it's important. 4 | 5 | Make it harder? Say your answer out loud - do so in under 1 minute. -------------------------------------------------------------------------------- /01_product_problems/problem_6.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Snapchat. 2 | 3 | How would you measure the success of Snap Maps? 4 | 5 | Make it harder? Whiteboard your answer. -------------------------------------------------------------------------------- /01_product_problems/problem_60.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Google. 2 | 3 | Imagine that you are a PM at Airbnb, and you are assigned to build a new way for businesses to travel. How would you measure if this hypothetical feature was successful? 4 | 5 | Make it harder? Analyze core behaviors. -------------------------------------------------------------------------------- /01_product_problems/problem_61.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Spotify. 2 | 3 | Let's say our installs increased 25% — what are reasons this might have happened? 4 | 5 | Make it harder? Provide four different reasons why this could have happened. -------------------------------------------------------------------------------- /01_product_problems/problem_62.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Airbnb. 2 | 3 | Pick any product, not including Airbnb. How would you make it better? 4 | 5 | For this solution, we'll be using Twitch. 6 | 7 | Make it harder? Follow along and use Twitch in your response. -------------------------------------------------------------------------------- /01_product_problems/problem_63.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Apple. 2 | 3 | Design a better dog collar. 4 | 5 | Make it harder? Propose at least three different improvements you can make to existing collars. -------------------------------------------------------------------------------- /01_product_problems/problem_64.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Uber. 2 | 3 | What is the size of the food delivery market in the United States? 4 | 5 | Make it harder? Provide a bottom-up analysis. -------------------------------------------------------------------------------- /01_product_problems/problem_65.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Uber. 2 | 3 | Let's say we changed our referral system. How would you measure it's success? 4 | 5 | Make it harder? Analyze core behaviors. 6 | -------------------------------------------------------------------------------- /01_product_problems/problem_66.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Google. 2 | 3 | Tell me about a product you like. 4 | 5 | For this problem we'll be using Chess.com. 6 | 7 | Make it harder? Follow along and use Chess.com as your answer. -------------------------------------------------------------------------------- /01_product_problems/problem_67.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Facebook. 2 | 3 | Why do you want to work at Facebook? 4 | 5 | Make it harder? Provide at least three distinct reasons. -------------------------------------------------------------------------------- /01_product_problems/problem_68.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Fiverr. 2 | 3 | At Fiverr, we're always looking for new markets to enter. One region we're looking at in particular is Asia. How would you grow Fiverr in Asia? 4 | 5 | Make it harder? Focus on China. -------------------------------------------------------------------------------- /01_product_problems/problem_69.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Venmo. 2 | 3 | What would you do if, all of a sudden, our web traffic dropped by 100%? 4 | 5 | Make it harder? Ask a friend to mock you with this question and use the solution guide as a prompt. -------------------------------------------------------------------------------- /01_product_problems/problem_7.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Facebook. 2 | 3 | Pretend you've just been hired as the product manager for Facebook Marketplaces. You notice one core user group are those using Marketplaces to buy and sell used cars. How would you make their experience better? 4 | 5 | Make it harder? You cannot implement any demand (buy-side) features. -------------------------------------------------------------------------------- /01_product_problems/problem_70.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by WhatsApp. 2 | 3 | Let's say WeChat wanted to have a larger presence here. What should they do to further expand into America? 4 | 5 | Make it harder? Evaluate at least five different channels. 6 | -------------------------------------------------------------------------------- /01_product_problems/problem_71.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Airbnb. 2 | 3 | What are some reasons why WeWork failed? 4 | 5 | Make it harder? Name at least three different reasons. -------------------------------------------------------------------------------- /01_product_problems/problem_72.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Facebook. 2 | 3 | How would you improve Instagram's share feature? 4 | 5 | Make it harder? Be precise - cover all topics in the Improve a Product formula in under five minutes. -------------------------------------------------------------------------------- /01_product_problems/problem_73.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Twitch. 2 | 3 | Why do you want to work at Twitch? 4 | 5 | Make it harder? Provide at least three distinct reasons. -------------------------------------------------------------------------------- /01_product_problems/problem_74.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Airbnb. 2 | 3 | Design a better way for people to vote in the US Presidential election. 4 | 5 | Make it harder? Propose and evaluate at least three different solutions. -------------------------------------------------------------------------------- /01_product_problems/problem_75.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by PayPal. 2 | 3 | Late last year we decided to acquire Honey for almost $4 billion. What are some reasons we may have done this? 4 | 5 | Make it harder? Name at least five different reasons. -------------------------------------------------------------------------------- /01_product_problems/problem_76.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Google. 2 | 3 | How much oil does the United States import (in barrels per year)? 4 | 5 | Make it harder? Ask a friend to provide a mock interview with this question. Tell them to use the solution as a guide if you get stuck. -------------------------------------------------------------------------------- /01_product_problems/problem_77.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Microsoft. 2 | 3 | What's your biggest weakness? 4 | 5 | Make it harder? Use being too agreeable as your answer. -------------------------------------------------------------------------------- /01_product_problems/problem_78.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Microsoft. 2 | 3 | What are some reasons why Google acquired Fitbit? 4 | 5 | Make it harder? Name at least five different reasons. -------------------------------------------------------------------------------- /01_product_problems/problem_79.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Google. 2 | 3 | How would you measure metrics for the BART? 4 | 5 | BART stands for Bay Area Rapid Transit and is the public train transportation system in the San Francisco Bay Area. 6 | 7 | Make it harder? Come up with at least 5 different metrics. -------------------------------------------------------------------------------- /01_product_problems/problem_8.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Amazon. 2 | 3 | How would you design a wedding registry product? 4 | 5 | Make it harder? Use Amazon features to improve the experience. -------------------------------------------------------------------------------- /01_product_problems/problem_80.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Disney. 2 | 3 | The NBA has become the most watched sport in North America. One thing many of it's watchers complain about though is access to games. How would you improve NBA League Pass for basketball fans across the world? 4 | 5 | NBA League Pass is the NBA's proprietary live and on-demand game streaming service. 6 | 7 | Make it harder? Offer at least two unique improvements. -------------------------------------------------------------------------------- /01_product_problems/problem_81.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Salesforce. 2 | 3 | Tell me about a SaaS product you really like using. 4 | 5 | For this problem we'll be using Shopify. 6 | 7 | Make it harder? Use Shopify and pretend you, yourself, built a custom portrait painting business through the platform. -------------------------------------------------------------------------------- /01_product_problems/problem_82.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Lime. 2 | 3 | What is the size of the micromobility market in the United States? 4 | 5 | Make it harder? Use existing micromobility company valuations to check your answer. -------------------------------------------------------------------------------- /01_product_problems/problem_83.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by 23andMe. 2 | 3 | Assume our conversion dropped 33%, what would you do? 4 | 5 | Make it harder? Ask a friend to mock you with this question! They should use this solution as a guide to prompt you. -------------------------------------------------------------------------------- /01_product_problems/problem_84.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Facebook. 2 | 3 | Why do you want to work at Oculus? 4 | 5 | Make it harder? Provide at least three distinct reasons. -------------------------------------------------------------------------------- /01_product_problems/problem_85.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Facebook. 2 | 3 | Let's say it's 2009, and Facebook just launched the Like button. You want to extend it with reactions. Explain, in plain English, how to accomplish that technically. 4 | 5 | Make it harder? Make it so your system allows as many types of reactions as you want. 6 | -------------------------------------------------------------------------------- /01_product_problems/problem_86.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Asana. 2 | 3 | How would you design ClassPass for kids? 4 | 5 | Make it harder? Whiteboard your solution. 6 | -------------------------------------------------------------------------------- /01_product_problems/problem_87.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Microsoft. 2 | 3 | Pick any physical product you really like and tell me about it. 4 | 5 | For this problem we'll be using Patagonia. 6 | 7 | Make it harder? Follow along and use Patagonia as your answer. -------------------------------------------------------------------------------- /01_product_problems/problem_88.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by reddit. 2 | 3 | Let's say your first job here was to expand into the Japanese market. How would you do that? 4 | 5 | Make it harder? What are the risks for entering Japan? -------------------------------------------------------------------------------- /01_product_problems/problem_89.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Netflix. 2 | 3 | How would you improve our product? 4 | 5 | Make it harder? Offer at least two unique improvements. -------------------------------------------------------------------------------- /01_product_problems/problem_9.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Oculus. 2 | 3 | A key component for the VR experience at Oculus is the Oculus Store. The Oculus Store is a marketplace that connects users with the creations of the thousands of developers in the Oculus ecosystem. How would you improve the Oculus Store if you were hired here? 4 | 5 | Make it harder? Double down on one user type for your solution. -------------------------------------------------------------------------------- /01_product_problems/problem_90.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Spotify. 2 | 3 | We launched in South Africa in 2018, but let's say we didn't - how would you lead a launch into that region? 4 | 5 | Make it harder? Consider the different languages in South Africa. -------------------------------------------------------------------------------- /01_product_problems/problem_91.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Shopify. 2 | 3 | In many products, churn and retention are really important to evaluating long-term success. Do you think it's okay for Shopify to have high churn? 4 | 5 | Make it harder? Make an argument for both sides. -------------------------------------------------------------------------------- /01_product_problems/problem_92.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Stripe. 2 | 3 | What's your biggest weakness? 4 | 5 | Make it harder? Use being too micro-managey as your answer. -------------------------------------------------------------------------------- /01_product_problems/problem_93.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by HubSpot. 2 | 3 | What's another Enterprise product you look up to? Don't use Hubspot. 4 | 5 | For this problem we'll be using Intercom. 6 | 7 | Make it harder? Use Intercom and pretend you've used it in the past. -------------------------------------------------------------------------------- /01_product_problems/problem_94.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Facebook. 2 | 3 | Build a new birthday feature for Facebook. 4 | 5 | Make it harder? Whiteboard your solution. -------------------------------------------------------------------------------- /01_product_problems/problem_95.txt: -------------------------------------------------------------------------------- 1 | This problem was asked recently by Twitter. 2 | 3 | How many tweets are tweeted every day on Twitter? 4 | 5 | Make it harder? Assume this is the global amount of tweets. -------------------------------------------------------------------------------- /01_product_problems/problem_96.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Asana. 2 | 3 | Design Uber for laundry. 4 | 5 | Make it harder? Whiteboard your solution for the supply side of the app. -------------------------------------------------------------------------------- /01_product_problems/problem_97.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Codecademy. 2 | 3 | Signups on our landing page are up 15% - why do you think this happened? 4 | 5 | Make it harder? 90% of new signups are on mobile. -------------------------------------------------------------------------------- /01_product_problems/problem_98.txt: -------------------------------------------------------------------------------- 1 | This question was recently asked by Google. 2 | 3 | Imagine you're a new product manager at Asana, and you're assigned to improve the ticketing software. How would you measure the success of these improvements? 4 | 5 | Make it harder? Analyze core behaviors. -------------------------------------------------------------------------------- /01_product_problems/problem_99.txt: -------------------------------------------------------------------------------- 1 | This problem was recently asked by Robinhood. 2 | 3 | What are some endpoints we might have on our app? What do they do and what type of information would be needed? 4 | 5 | Make it harder? List at least 5 different endpoints. -------------------------------------------------------------------------------- /airbnb_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Airbnb. 2 | Given a list of integers, write a function that returns the largest sum of 3 | non-adjacent numbers. Numbers can be 0 or negative. 4 | For example, [2, 4, 6, 2, 5] should return 13, since we pick 2, 6, and 5. 5 | [5, 1, 1, 5] should return 10, since we pick 5 and 5. 6 | Follow-up: Can you do this in O(N) time and constant space? 7 | """ -------------------------------------------------------------------------------- /airbnb_problems/problem_3.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Airbnb. 2 | 3 | Given a list of words, find all pairs of unique 4 | indices such that the concatenation of the two words is a palindrome. 5 | 6 | For example, given the list ["code", "edoc", "da", "d"], return [(0, 1), (1, 0), (2, 3)]. 7 | """ -------------------------------------------------------------------------------- /airbnb_problems/problem_4.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Airbnb. 2 | Given a linked list and a positive integer k, rotate the list to the right by k places. 3 | For example, given the linked list 7 -> 7 -> 3 -> 5 and k = 2, it should become 3 -> 5 -> 7 -> 7. 4 | Given the linked list 1 -> 2 -> 3 -> 4 -> 5 and k = 3, it should become 3 -> 4 -> 5 -> 1 -> 2 5 | """ -------------------------------------------------------------------------------- /airbnb_problems/problem_5.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Airbnb. 2 | 3 | You come across a dictionary of sorted words in a language you've never seen before. 4 | Write a program that returns the correct order of letters in this language. 5 | 6 | For example, given ['xww', 'wxyz', 'wxyw', 'ywx', 'ywz'], you should return ['x', 'z', 'w', 'y']. 7 | """ -------------------------------------------------------------------------------- /airbnb_problems/problem_9.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Airbnb. 2 | 3 | Given an array of integers, return the largest range, inclusive, 4 | of integers that are all included in the array. 5 | 6 | For example, given the array [9, 6, 1, 3, 8, 10, 12, 11], 7 | return (8, 12) since 8, 9, 10, 11, and 12 are all in the array.""" -------------------------------------------------------------------------------- /airtable_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Airtable. 2 | 3 | How would you explain web cookies to someone non-technical?""" -------------------------------------------------------------------------------- /amazon_problems/problem_10.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Amazon. 2 | Given a matrix of 1s and 0s, return the number of "islands" in the matrix. 3 | A 1 represents land and 0 represents water, so an island is a group of 1s 4 | that are neighboring and their perimiter is surrounded by water. 5 | For example, this matrix has 4 islands. 6 | 1 0 0 0 0 7 | 0 0 1 1 0 8 | 0 1 1 0 0 9 | 0 0 0 0 0 10 | 1 1 0 0 1 11 | 1 1 0 0 1 12 | """ 13 | -------------------------------------------------------------------------------- /amazon_problems/problem_11.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Amazon. 2 | 3 | Given a node in a binary tree, return the next bigger element, also known as the inorder successor. 4 | 5 | For example, the inorder successor of 22 is 30. 6 | 7 | 10 8 | / \ 9 | 5 30 10 | / \ 11 | 22 35 12 | You can assume each node has a parent pointer. 13 | """ 14 | -------------------------------------------------------------------------------- /amazon_problems/problem_17.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Amazon. 2 | 3 | Given n numbers, find the greatest common denominator between them. 4 | 5 | For example, given the numbers [42, 56, 14], return 14. 6 | """ -------------------------------------------------------------------------------- /amazon_problems/problem_18.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Amazon. 2 | 3 | Given an array and a number k that's smaller than the length of the array, 4 | rotate the array to the right k elements in-place. 5 | """ -------------------------------------------------------------------------------- /amazon_problems/problem_19.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Amazon. 2 | Given a complete binary tree, count the number of nodes in faster than O(n) time. 3 | Recall that a complete binary tree has every level filled except the last, 4 | and the nodes in the last level are filled starting from the left. 5 | """ -------------------------------------------------------------------------------- /amazon_problems/problem_20.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Amazon. 2 | 3 | Given a sorted array, find the smallest positive integer that is not the sum of a subset of the array. 4 | 5 | For example, for the input [1, 2, 3, 10], you should return 7. 6 | 7 | Do this in O(N) time. 8 | """ -------------------------------------------------------------------------------- /amazon_problems/problem_21.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Amazon. 2 | 3 | A tree is symmetric if its data and shape remain unchanged when it is reflected about the root node. 4 | The following tree is an example: 5 | 6 | 4 7 | / | \ 8 | 3 5 3 9 | / \ 10 | 9 9 11 | Given a k-ary tree, determine whether it is symmetric. 12 | """ -------------------------------------------------------------------------------- /amazon_problems/problem_22.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Amazon. 2 | 3 | Given an array of a million integers between zero and a billion, out of order, 4 | how can you efficiently sort it? Assume that you cannot store an array of a billion elements in memory. 5 | """ -------------------------------------------------------------------------------- /amazon_problems/problem_24.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Amazon. 2 | 3 | Given an integer N, construct all possible binary search trees with N nodes. 4 | """ -------------------------------------------------------------------------------- /amazon_problems/problem_26.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Amazon. 2 | 3 | Given a linked list, remove all consecutive nodes that sum to zero. Print out the remaining nodes. 4 | 5 | For example, suppose you are given the input 3 -> 4 -> -7 -> 5 -> -6 -> 6. 6 | In this case, you should first remove 3 -> 4 -> -7, then -6 -> 6, leaving only 5. 7 | """ -------------------------------------------------------------------------------- /amazon_problems/problem_27.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Amazon. 2 | 3 | Given a string, find the length of the smallest window that contains every distinct character. 4 | Characters may appear more than once in the window. 5 | 6 | For example, given "jiujitsu", you should return 5, corresponding to the final five letters. 7 | """ -------------------------------------------------------------------------------- /amazon_problems/problem_30.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Amazon. 2 | 3 | Write a function that takes a natural number as input 4 | and returns the number of digits the input has. 5 | 6 | Constraint: don't use any loops. 7 | """ 8 | 9 | # idea: use the log of ten 10 | 11 | import numpy as np 12 | 13 | def number_of_digit(x): 14 | return np.floor(np.log10(x,10)) + 1 15 | -------------------------------------------------------------------------------- /amazon_problems/problem_31.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Amazon. 2 | 3 | Given a sorted array arr of distinct integers, 4 | return the lowest index i for which arr[i] == i. 5 | 6 | Return null if there is no such index. 7 | 8 | For example, given the array [-5, -3, 2, 3], 9 | return 2 since arr[2] == 2. Even though arr[3] == 3, 10 | we return 2 since it's the lowest index. 11 | """ -------------------------------------------------------------------------------- /amazon_problems/problem_32.py: -------------------------------------------------------------------------------- 1 | """This problem was recently asked by Amazon. 2 | 3 | How would you explain the difference between an API and SDK to a non-technical person? 4 | """ -------------------------------------------------------------------------------- /amazon_problems/problem_33.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Amazon. 2 | 3 | Given a linked list and an integer k, remove the k-th node from the end of the 4 | list and return the head of the list. 5 | 6 | k is guaranteed to be smaller than the length of the list. 7 | 8 | Do this in one pass. 9 | """ -------------------------------------------------------------------------------- /amazon_problems/problem_5.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Amazon. 2 | 3 | Given a string, find the longest palindromic contiguous substring. If there 4 | are more than one with the maximum length, return any one. 5 | 6 | For example, the longest palindromic substring of "aabcdcb" is "bcdcb". 7 | The longest palindromic substring of "bananas" is "anana". 8 | """ -------------------------------------------------------------------------------- /apple_problems/problem_10.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Apple. 2 | 3 | A fixed point in an array is an element whose value is equal to its index. 4 | Given a sorted array of distinct elements, return a fixed point, if one exists. Otherwise, return False. 5 | 6 | For example, given [-6, 0, 2, 40], you should return 2. Given [1, 5, 7, 8], you should return False. 7 | """ -------------------------------------------------------------------------------- /apple_problems/problem_11.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Apple. 2 | 3 | You are going on a road trip, and would like to create a suitable music playlist. 4 | The trip will require N songs, though you only have M songs downloaded, 5 | where M < N. A valid playlist should select each song at least once, 6 | and guarantee a buffer of B songs between repeats. 7 | 8 | Given N, M, and B, determine the number of valid playlists. 9 | """ -------------------------------------------------------------------------------- /apple_problems/problem_12.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Apple. 2 | 3 | Given a linked list, uniformly shuffle the nodes. 4 | What if we want to prioritize space over time? 5 | """ -------------------------------------------------------------------------------- /apple_problems/problem_13.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Apple. 2 | 3 | You are given a hexadecimal-encoded string that has been XOR'd against a single char. 4 | 5 | Decrypt the message. For example, given the string: 6 | 7 | 7a575e5e5d12455d405e561254405d5f1276535b5e4b12715d565b5c551262405d505e575f 8 | You should be able to decrypt it and get: 9 | 10 | Hello world from Daily Coding Problem 11 | """ -------------------------------------------------------------------------------- /apple_problems/problem_14.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Apple. 2 | 3 | Given a tree, find the largest tree/subtree that is a BST. 4 | 5 | Given a tree, return the size of the largest tree/subtree that is a BST. 6 | """ -------------------------------------------------------------------------------- /apple_problems/problem_4.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Apple. 2 | Given a tree, find the largest tree/subtree that is a BST. 3 | Given a tree, return the size of the largest tree/subtree that is a BST. 4 | """ -------------------------------------------------------------------------------- /apple_problems/problem_5.py: -------------------------------------------------------------------------------- 1 | """This question was asked by Apple. 2 | 3 | Given a binary tree, find a minimum path sum from root to a leaf. 4 | 5 | For example, the minimum path in this tree is [10, 5, 1, -1], which has sum 15. 6 | 7 | 10 8 | / \ 9 | 5 5 10 | \\ \ 11 | 2 1 12 | / 13 | -1 14 | """ -------------------------------------------------------------------------------- /apple_problems/problem_6.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Apple. 2 | Gray code is a binary code where each successive value differ in only one bit, 3 | as well as when wrapping around. 4 | Gray code is common in hardware so that we don't see temporary spurious values during transitions. 5 | Given a number of bits n, generate a possible gray code for it. 6 | For example, for n = 2, one gray code would be [00, 01, 11, 10]. 7 | """ -------------------------------------------------------------------------------- /apple_problems/problem_7.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Apple. 2 | 3 | Given the root of a binary tree, find the most frequent subtree sum. 4 | The subtree sum of a node is the sum of all values under a node, including the node itself. 5 | 6 | For example, given the following tree: 7 | 8 | 5 9 | / \ 10 | 2 -5 11 | Return 2 as it occurs twice: once as the left leaf, and once as the sum of 2 + 5 - 5. 12 | """ -------------------------------------------------------------------------------- /apple_problems/problem_9.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Apple. 2 | Implement the function fib(n), which returns the nth number 3 | in the Fibonacci sequence, using only O(1) space. 4 | """ -------------------------------------------------------------------------------- /cisco_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Cisco. 2 | 3 | Given an unsigned 8-bit integer, swap its even and odd bits. 4 | The 1st and 2nd bit should be swapped, the 3rd and 4th bit should be swapped, and so on. 5 | 6 | For example, 10101010 should be 01010101. 11100010 should be 11010001. 7 | 8 | Bonus: Can you do this in one line? 9 | """ 10 | -------------------------------------------------------------------------------- /coinbase_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Coinbase. 2 | 3 | Write a function that takes in a number, string, list, or dictionary and 4 | returns its JSON encoding. It should also handle nulls. 5 | 6 | For example, given the following input: 7 | 8 | [None, 123, ["a", "b"], {"c":"d"}] 9 | You should return the following, as a string: 10 | 11 | '[null, 123, ["a", "b"], {"c": "d"}]' 12 | """ -------------------------------------------------------------------------------- /data_structure/__pycache__/linked_list.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Younes-Charfaoui/Daily-Coding-Problem/3d3e18496b384889d4845fc4af24ecd713a0c3b6/data_structure/__pycache__/linked_list.cpython-36.pyc -------------------------------------------------------------------------------- /dropbox_problem/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Dropbox. 2 | Given the root to a binary search tree, find 3 | the second largest node in the tree. 4 | """ -------------------------------------------------------------------------------- /dropbox_problem/problem_10.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Dropbox. 2 | 3 | Create an algorithm to efficiently compute the approximate median of a list of numbers. 4 | 5 | More precisely, given an unordered list of N numbers, find an element whose rank 6 | is between N / 4 and 3 * N / 4, with a high level of certainty, in less than O(N) time.""" -------------------------------------------------------------------------------- /dropbox_problem/problem_12.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Dropbox. 2 | 3 | Create a data structure that performs all the following operations in O(1) time: 4 | 5 | plus: Add a key with value 1. If the key already exists, increment its value by one. 6 | minus: Decrement the value of a key. If the key's value is currently 1, remove it. 7 | get_max: Return a key with the highest value. 8 | get_min: Return a key with the lowest value. 9 | """ -------------------------------------------------------------------------------- /dropbox_problem/problem_3.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Dropbox. 2 | 3 | Sudoku is a puzzle where you're given a partially-filled 9 by 9 4 | grid with digits. The objective is to fill the grid with the 5 | constraint that every row, column, and box (3 by 3 subgrid) must contain all of 6 | the digits from 1 to 9. 7 | 8 | Implement an efficient sudoku solver. 9 | """ -------------------------------------------------------------------------------- /dropbox_problem/problem_4.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Dropbox. 2 | What does the below code snippet print out? How can we fix the anonymous functions to behave as we'd expect? 3 | functions = [] 4 | for i in range(10): 5 | functions.append(lambda : i) 6 | 7 | for f in functions: 8 | print(f()) 9 | 10 | """ -------------------------------------------------------------------------------- /dropbox_problem/problem_6.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Dropbox. 2 | 3 | Given an undirected graph G, check whether it is bipartite. 4 | Recall that a graph is bipartite if its vertices can be divided into two 5 | independent sets, U and V, such that no edge connects vertices of the same set.""" -------------------------------------------------------------------------------- /dropbox_problem/problem_7.py: -------------------------------------------------------------------------------- 1 | """TThis problem was asked by Dropbox. 2 | 3 | Spreadsheets often use this alphabetical encoding for its columns: 4 | "A", "B", "C", ..., "AA", "AB", ..., "ZZ", "AAA", "AAB", .... 5 | 6 | Given a column number, return its alphabetical column id. 7 | For example, given 1, return "A". Given 27, return "AA".""" 8 | 9 | def spreadsheet(number): 10 | return number//26 + 1 11 | 12 | spreadsheet(27) -------------------------------------------------------------------------------- /dropbox_problem/problem_9.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Dropbox. 2 | 3 | Implement an efficient string matching algorithm. 4 | 5 | That is, given a string of length N and a pattern of length k, write a program that searches 6 | for the pattern in the string with less than O(N * k) worst-case time complexity. 7 | 8 | If the pattern is found, return the start index of its location. If not, return False.""" -------------------------------------------------------------------------------- /etsy_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Etsy. 2 | 3 | Given an array of numbers N and an integer k, your task is to split N into k 4 | partitions such that the maximum sum of any partition is minimized. Return this sum. 5 | 6 | For example, given N = [5, 1, 2, 7, 3, 4] and k = 3, you should return 8, since the optimal 7 | partition is [5, 1, 2], [7], [3, 4]. 8 | """ -------------------------------------------------------------------------------- /etsy_problems/problem_2.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Etsy. 2 | 3 | Given a sorted array, convert it into a height-balanced binary search tree. 4 | """ -------------------------------------------------------------------------------- /facebook_problems/problem_14.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Facebook. 2 | 3 | Given three integers x,y and b, return x if b is equal to 0, and y if b is equal to 1. 4 | 5 | Do this only using mathematical and bits operation. 6 | 7 | You can assume that b is 1 or 0.""" -------------------------------------------------------------------------------- /facebook_problems/problem_15.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Facebook. 2 | Given a function f, and N return a debounced f of N milliseconds. 3 | That is, as long as the debounced f continues to be invoked, f itself will not be called for N milliseconds. 4 | """ -------------------------------------------------------------------------------- /facebook_problems/problem_16.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Facebook. 2 | Given a binary tree, return all paths from the root to leaves. 3 | For example, given the tree 4 | 1 5 | / \ 6 | 2 3 7 | / \ 8 | 4 5 9 | it should return [[1, 2], [1, 3, 4], [1, 3, 5]]. 10 | 11 | """ -------------------------------------------------------------------------------- /facebook_problems/problem_17.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Facebook. 2 | 3 | Given a string and a set of delimiters, reverse the words in the string 4 | while maintaining the relative order of the delimiters. For example, given "hello/world:here", return "here/world:hello" 5 | 6 | Follow-up: Does your solution work for the 7 | following cases: "hello/world:here/", "hello//world:here" 8 | """ -------------------------------------------------------------------------------- /facebook_problems/problem_18.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Facebook. 2 | 3 | Given a binary tree, return the level of the tree with minimum sum. 4 | """ -------------------------------------------------------------------------------- /facebook_problems/problem_19.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Facebook. 2 | 3 | Write a function that rotates a list by k elements. 4 | For example, [1, 2, 3, 4, 5, 6] rotated by two becomes [3, 4, 5, 6, 1, 2]. 5 | Try solving this without creating a copy of the list. 6 | How many swap or move operations do you need? 7 | """ -------------------------------------------------------------------------------- /facebook_problems/problem_2.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Facebook. 2 | 3 | Given a stream of elements too large to store in memory, 4 | pick a random element from the stream with uniform probability.""" -------------------------------------------------------------------------------- /facebook_problems/problem_20.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Facebook. 2 | 3 | Given an array of numbers representing the stock prices of a company in chronological order and an integer k, 4 | return the maximum profit you can make from k buys and sells. 5 | You must buy the stock before you can sell it, and you must sell the stock before you can buy it again. 6 | 7 | For example, given k = 2 and the array [5, 2, 4, 0, 1], you should return 3. 8 | """ -------------------------------------------------------------------------------- /facebook_problems/problem_21.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Facebook. 2 | 3 | You have a large array with most of the elements as zero. 4 | 5 | Use a more space-efficient data structure, SparseArray, that implements the same interface: 6 | 7 | init(arr, size): initialize with the original large array and size. 8 | set(i, val): updates index at i with val. 9 | get(i): gets the value at index i. 10 | """ -------------------------------------------------------------------------------- /facebook_problems/problem_22.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Facebook. 2 | 3 | Given an array of integers in which two elements appear exactly once and all other elements appear exactly twice 4 | , find the two elements that appear only once. 5 | 6 | For example, given the array [2, 4, 6, 8, 10, 2, 6, 10], return 4 and 8. The order does not matter. 7 | 8 | Follow-up: Can you do this in linear time and constant space? 9 | """ -------------------------------------------------------------------------------- /facebook_problems/problem_23.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Facebook. 2 | Given a positive integer n, find the smallest number of squared integers which sum to n. 3 | For example, given n = 13, return 2 since 13 = 3^2 + 2^2 = 9 + 4. 4 | Given n = 27, return 3 since 27 = 3^2 + 3^2 + 3^2 = 9 + 9 + 9. 5 | """ -------------------------------------------------------------------------------- /facebook_problems/problem_24.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Facebook. 2 | 3 | Given a 32-bit integer, return the number with its bits reversed. 4 | 5 | For example, given the binary number 1111 0000 1111 0000 1111 0000 1111 0000, 6 | return 0000 1111 0000 1111 0000 1111 0000 1111. 7 | """ -------------------------------------------------------------------------------- /facebook_problems/problem_25.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Facebook. 2 | 3 | Given an N by N matrix, rotate it by 90 degrees clockwise. 4 | 5 | For example, given the following matrix: 6 | 7 | [[1, 2, 3], 8 | [4, 5, 6], 9 | [7, 8, 9]] 10 | you should return: 11 | 12 | [[7, 4, 1], 13 | [8, 5, 2], 14 | [9, 6, 3]] 15 | Follow-up: What if you couldn't use any extra space? 16 | """ -------------------------------------------------------------------------------- /facebook_problems/problem_27.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Facebook. 2 | A graph is minimally-connected if it is connected and there is no edge 3 | that can be removed while still leaving the graph connected. 4 | For example, any binary tree is minimally-connected. 5 | Given an undirected graph, check if the graph is minimally-connected. 6 | You can choose to represent the graph as either an adjacency matrix or adjacency list. 7 | """ -------------------------------------------------------------------------------- /facebook_problems/problem_28.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Facebook. 2 | 3 | Given a circular array, compute its maximum subarray sum in O(n) time. 4 | 5 | For example, given [8, -1, 3, 4], return 15 as we 6 | choose the numbers 3, 4, and 8 where the 8 is obtained from wrapping around. 7 | 8 | Given [-4, 5, 1, 0], return 6 as we choose the numbers 5 and 1. 9 | """ -------------------------------------------------------------------------------- /facebook_problems/problem_29.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Facebook. 2 | 3 | Suppose you are given two lists of n points, one list p1, p2, ..., pn on the 4 | line y = 0 and the other list q1, q2, ..., qn on the line y = 1. 5 | Imagine a set of n line segments connecting each point pi to qi. 6 | Write an algorithm to determine how many pairs of the line segments intersect. 7 | """ -------------------------------------------------------------------------------- /facebook_problems/problem_3.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Facebook. 2 | 3 | A builder is looking to build a row of N houses that can be of K different colors. 4 | He has a goal of minimizing cost while ensuring that no two neighboring houses 5 | are of the same color. 6 | 7 | Given an N by K matrix where the nth row and kth column represents the cost 8 | to build the nth house with kth color, return the minimum cost which achieves 9 | this goal.""" -------------------------------------------------------------------------------- /facebook_problems/problem_30.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Facebook. 2 | 3 | Given a string of parentheses, find the balanced string that can be produced from it using the minimum number of insertions and deletions. If there are multiple solutions, return any of them. 4 | 5 | For example, given "(()", you could return "(())". Given "))()(", you could return "()()()()". 6 | """ -------------------------------------------------------------------------------- /facebook_problems/problem_32.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Facebook. 2 | 3 | Boggle is a game played on a 4 x 4 grid of letters. The goal is to find as many words as possible that 4 | can be formed by a sequence of adjacent letters in the grid, using each cell at most once. 5 | Given a game board and a dictionary of valid words, implement a Boggle solve 6 | """ -------------------------------------------------------------------------------- /facebook_problems/problem_33.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Facebook. 2 | 3 | Given an array of numbers of length N, find both the 4 | minimum and maximum using less than 2 * (N - 2) comparisons. 5 | """ -------------------------------------------------------------------------------- /facebook_problems/problem_34.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Facebook. 2 | 3 | Given a string consisting of parentheses, single digits, and positive and negative signs, 4 | convert the string into a mathematical expression to obtain the answer. 5 | 6 | Don't use eval or a similar built-in parser. 7 | 8 | For example, given '-1 + (2 + 3)', you should return 4. 9 | """ -------------------------------------------------------------------------------- /facebook_problems/problem_37.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Facebook. 2 | 3 | Given an integer n, find the next biggest integer with the 4 | same number of 1-bits on. For example, given the number 6 5 | (0110 in binary), return 9 (1001).""" -------------------------------------------------------------------------------- /facebook_problems/problem_39.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Facebook. 2 | 3 | Describe an algorithm to compute the longest increasing subsequence of 4 | an array of numbers in O(n log n) time. 5 | """ -------------------------------------------------------------------------------- /facebook_problems/problem_40.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Facebook. 2 | 3 | Given a list of integers L, find the maximum length of a sequence of consecutive 4 | numbers that can be formed using elements from L. 5 | 6 | For example, given L = [5, 2, 99, 3, 4, 1, 100], return 5 as we 7 | can build a sequence [1, 2, 3, 4, 5] which has length 5. 8 | """ -------------------------------------------------------------------------------- /facebook_problems/problem_42.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Facebook. 2 | 3 | Given a list of strictly positive integers, partition the list into 3 contiguous 4 | partitions which each sum up to the same value. If not possible, return null. 5 | 6 | For example, given the following list: 7 | 8 | [3, 5, 8, 0, 8] 9 | Return the following 3 partitions: 10 | 11 | [[3, 5], 12 | [8, 0], 13 | [8]] 14 | Which each add up to 8. 15 | """ -------------------------------------------------------------------------------- /facebook_problems/problem_9.py: -------------------------------------------------------------------------------- 1 | """Given a function that generates perfectly random numbers 2 | between 1 and k (inclusive), where k is an input, write a function 3 | that shuffles a deck of cards represented as an array using only swaps. 4 | It should run in O(N) time. 5 | Hint: Make sure each one of the 52! 6 | permutations of the deck is equally likely. 7 | """ -------------------------------------------------------------------------------- /fitbit_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Fitbit. 2 | 3 | Given a linked list, rearrange the node values such that they appear in alternating low -> high -> low -> high ... form. 4 | For example, given 1 -> 2 -> 3 -> 4 -> 5, you should return 1 -> 3 -> 2 -> 5 -> 4. 5 | """ -------------------------------------------------------------------------------- /flipkart_problems/problem_2.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Flipkart. 2 | 3 | Starting from 0 on a number line, you would like to make 4 | a series of jumps that lead to the integer N. 5 | 6 | On the ith jump, you may move exactly i places to the left or right. 7 | 8 | Find a path with the fewest number of jumps required to get from 0 to N. 9 | """ -------------------------------------------------------------------------------- /goldman_sachs_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Goldman Sachs. 2 | Given a list of numbers L, implement a method sum(i, j) 3 | which returns the sum from the sublist L[i:j] (including i, excluding j). 4 | For example, given L = [1, 2, 3, 4, 5], sum(1, 3) should return sum([2, 3]), which is 5. 5 | You can assume that you can do some pre-processing. 6 | sum() should be optimized over the pre-processing step. 7 | """ 8 | -------------------------------------------------------------------------------- /google_problems/problem_11.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | Given a singly linked list and an integer k, remove the kth last element from the list. k is guaranteed to be smaller than the length of the list. 3 | The list is very long, so making more than one pass is prohibitively expensive. 4 | Do this in constant space and in one pass. 5 | """ -------------------------------------------------------------------------------- /google_problems/problem_14.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | 3 | The power set of a set is the set of all its subsets. 4 | Write a function that, given a set, generates its power set. 5 | 6 | For example, given the set {1, 2, 3}, it should return 7 | {{}, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}}. 8 | 9 | You may also use a list or array to represent a set.""" 10 | -------------------------------------------------------------------------------- /google_problems/problem_15.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | 3 | Given an array of integers where every integer occurs three times except 4 | for one integer, which only occurs once, find and return the non-duplicated integer. 5 | 6 | For example, given [6, 1, 3, 3, 3, 6, 6], 7 | return 1. Given [13, 19, 13, 13], return 19. 8 | 9 | Do this in O(N) time and O(1) space.""" 10 | -------------------------------------------------------------------------------- /google_problems/problem_20.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | Given an undirected graph represented as an adjacency matrix and an integer 3 | k, write a function to determine whether each vertex in the graph can be 4 | colored such that no two adjacent vertices share 5 | the same color using at most k colors""" -------------------------------------------------------------------------------- /google_problems/problem_21.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | Implement a file syncing algorithm for two computers over 3 | a low-bandwidth network. What if we know the 4 | files in the two computers are mostly the same? 5 | """ -------------------------------------------------------------------------------- /google_problems/problem_23.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | 3 | A knight's tour is a sequence of moves by a knight on a 4 | chessboard such that all squares are visited once. 5 | 6 | Given N, write a function to return the number 7 | of knight's tours on an N by N chessboard. 8 | """ -------------------------------------------------------------------------------- /google_problems/problem_27.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | Given the head of a singly linked list, reverse it in-place. 3 | """ -------------------------------------------------------------------------------- /google_problems/problem_29.py: -------------------------------------------------------------------------------- 1 | """This problem was asked recently by Google. 2 | Given k sorted singly linked lists, write a function to merge 3 | all the lists into one sorted singly linked list. 4 | """ -------------------------------------------------------------------------------- /google_problems/problem_32.py: -------------------------------------------------------------------------------- 1 | """This question was asked by Google. 2 | 3 | Given an integer n and a list of integers l, write a function that 4 | randomly generates a number from 0 to n-1 that isn't in l (uniform). 5 | """ -------------------------------------------------------------------------------- /google_problems/problem_33.py: -------------------------------------------------------------------------------- 1 | """This question was asked by Google. 2 | 3 | This problem was asked by Google. 4 | Given a binary tree of integers, find the maximum path sum between two nodes. 5 | The path must go through at least one node, and does not need to go through the root. 6 | """ -------------------------------------------------------------------------------- /google_problems/problem_35.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | Determine whether a doubly linked list is a palindrome. What if it’s singly linked? 3 | For example, 1 -> 4 -> 3 -> 4 -> 1 returns true while 1 -> 4 returns false. 4 | """ -------------------------------------------------------------------------------- /google_problems/problem_36.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | Given two strings A and B, return whether or not A can be shifted some number of times to get B. 3 | For example, if A is abcde and B is cdeab, return true. If A is abc and B is acb, return false. 4 | """ -------------------------------------------------------------------------------- /google_problems/problem_37.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | Given a word W and a string S, find all starting indices in S which are anagrams of W. 3 | For example, given that W is "ab", and S is "abxaba", return 0, 3, and 4. 4 | """ -------------------------------------------------------------------------------- /google_problems/problem_38.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | Given a string of words delimited by spaces, reverse the words in string. For example, 3 | given "hello world here", return "here world hello" 4 | Follow-up: given a mutable string representation, can you perform this operation in-place? 5 | """ -------------------------------------------------------------------------------- /google_problems/problem_39.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | 3 | Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node 4 | values with a subtree of s. A subtree of s is a tree consists of a node in s and all of this node's descendants. 5 | The tree s could also be considered as a subtree of itself. 6 | """ -------------------------------------------------------------------------------- /google_problems/problem_4.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | A unival tree (which stands for "universal value") is a tree where all nodes 3 | under it have the same value. 4 | 5 | Given the root to a binary tree, count the number of unival subtrees. 6 | 7 | For example, the following tree has 5 unival subtrees: 8 | 9 | 0 10 | / \ 11 | 1 0 12 | / \ 13 | 1 0 14 | / \ 15 | 1 1 16 | """ -------------------------------------------------------------------------------- /google_problems/problem_40.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | 3 | Given a sorted list of integers, square the elements and give the output in sorted order. 4 | 5 | For example, given [-9, -2, 0, 2, 3], return [0, 4, 4, 9, 81]. 6 | """ -------------------------------------------------------------------------------- /google_problems/problem_41.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | 3 | Given a set of closed intervals, find the smallest set of 4 | numbers that covers all the intervals. If there are multiple smallest sets, return any of them. 5 | 6 | For example, given the intervals [0, 3], [2, 6], [3, 4], [6, 9], 7 | one set of numbers that covers all these intervals is {3, 6}. 8 | """ -------------------------------------------------------------------------------- /google_problems/problem_42.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | 3 | Given a string which we can delete at most k, return whether you can make a palindrome. 4 | 5 | For example, given 'waterrfetawx' and a k of 2, you could delete f and x to get 'waterretaw'. 6 | """ -------------------------------------------------------------------------------- /google_problems/problem_43.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | 3 | Given the root of a binary search tree, and a target K, return two nodes in the tree whose sum equals K. 4 | 5 | For example, given the following tree and K of 20 6 | 7 | 10 8 | / \ 9 | 5 15 10 | / \ 11 | 11 15 12 | Return the nodes 5 and 15. 13 | """ -------------------------------------------------------------------------------- /google_problems/problem_44.py: -------------------------------------------------------------------------------- 1 | """This question was asked by Google. 2 | 3 | Given an N by M matrix consisting only of 1's and 0's, find the largest rectangle containing only 1's and 4 | return its area. 5 | 6 | For example, given the following matrix: 7 | 8 | [[1, 0, 0, 0], 9 | [1, 0, 1, 1], 10 | [1, 0, 1, 1], 11 | [0, 1, 0, 0]] 12 | Return 4. 13 | """ -------------------------------------------------------------------------------- /google_problems/problem_45.py: -------------------------------------------------------------------------------- 1 | """This question was asked by Google. 2 | Find the minimum number of coins required to make n cents. 3 | You can use standard American denominations, that is, 1¢, 5¢, 10¢, and 25¢. 4 | For example, given n = 16, return 3 since we can make it with a 10¢, a 5¢, and a 1¢. 5 | """ -------------------------------------------------------------------------------- /google_problems/problem_47.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | You're given a string consisting solely of (, ), and *. * can represent either a (, ), or an empty string. 3 | Determine whether the parentheses are balanced. 4 | For example, (()* and (*) are balanced. )*( is not balanced. 5 | """ -------------------------------------------------------------------------------- /google_problems/problem_49.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | Given the head of a singly linked list, swap every two nodes and return its head. 3 | For example, given 1 -> 2 -> 3 -> 4, return 2 -> 1 -> 4 -> 3. 4 | """ -------------------------------------------------------------------------------- /google_problems/problem_5.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | 3 | The area of a circle is defined as πr^2. Estimate π to 3 decimal 4 | places using a Monte Carlo method. 5 | 6 | Hint: The basic equation of a circle is x2 + y2 = r2.""" -------------------------------------------------------------------------------- /google_problems/problem_50.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | 3 | Given a string, return the first recurring character in it, or null if there is no recurring chracter. 4 | 5 | For example, given the string "acbbac", return "b". Given the string "abcdef", return null. 6 | """ -------------------------------------------------------------------------------- /google_problems/problem_51.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | You are given an array of length n + 1 whose elements belong to the set {1, 2, ..., n}. 3 | By the pigeonhole principle, there must be a duplicate. Find it in linear time and space 4 | """ -------------------------------------------------------------------------------- /google_problems/problem_53.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | 3 | Given a linked list, sort it in O(n log n) time and constant space. 4 | 5 | For example, the linked list 4 -> 1 -> -3 -> 99 should become -3 -> 1 -> 4 -> 99. 6 | """ -------------------------------------------------------------------------------- /google_problems/problem_55.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | 3 | Given the sequence of keys visited by a postorder traversal of a binary search tree, reconstruct the tree. 4 | 5 | For example, given the sequence 2, 4, 3, 8, 7, 5, you should construct the following tree: 6 | 7 | 5 8 | / \ 9 | 3 7 10 | / \\ \ 11 | 2 4 8 12 | """ -------------------------------------------------------------------------------- /google_problems/problem_57.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | 3 | Given a string, split it into as few strings as possible such that each string is a palindrome. 4 | 5 | For example, given the input string racecarannakayak, return ["racecar", "anna", "kayak"]. 6 | 7 | Given the input string abc, return ["a", "b", "c"]. 8 | """ -------------------------------------------------------------------------------- /google_problems/problem_61.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | Given an array of elements, return the length of the longest 3 | subarray where all its elements are distinct. 4 | For example, given the array [5, 1, 3, 5, 2, 3, 4, 1], 5 | return 5 as the longest subarray of distinct elements is [5, 2, 3, 4, 1]. 6 | """ -------------------------------------------------------------------------------- /google_problems/problem_64.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | 3 | Given a set of distinct positive integers, find the largest subset such that every 4 | pair of elements in the subset (i, j) satisfies either i % j = 0 or j % i = 0. 5 | 6 | For example, given the set [3, 5, 10, 20, 21], you should return [5, 10, 20]. 7 | Given [1, 3, 6, 24], return [1, 3, 6, 24]. 8 | """ -------------------------------------------------------------------------------- /google_problems/problem_67.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | 3 | A cryptarithmetic puzzle is a mathematical game where the digits of some numbers are represented by letters. 4 | Each letter represents a unique digit. 5 | 6 | For example, a puzzle of the form: 7 | 8 | SEND 9 | + MORE 10 | -------- 11 | MONEY 12 | may have the solution: 13 | 14 | {'S': 9, 'E': 5, 'N': 6, 'D': 7, 'M': 1, 'O', 0, 'R': 8, 'Y': 2} 15 | """ -------------------------------------------------------------------------------- /google_problems/problem_72.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | 3 | In linear algebra, a Toeplitz matrix is one in which the elements on any given 4 | diagonal from top left to bottom right are identical. 5 | 6 | Here is an example: 7 | 8 | 1 2 3 4 8 9 | 5 1 2 3 4 10 | 4 5 1 2 3 11 | 7 4 5 1 2 12 | Write a program to determine whether a given input is a Toeplitz matrix. 13 | """ -------------------------------------------------------------------------------- /google_problems/problem_74.py: -------------------------------------------------------------------------------- 1 | """ 2 | This problem was asked by Google. 3 | Given a set of points (x, y) on a 2D cartesian plane, 4 | find the two closest points. For example, given the points 5 | [(1, 1), (-1, -1), (3, 4), (6, 1), (-1, -6), (-4, -3)], return [(-1, -1), (1, 1)]. 6 | """ -------------------------------------------------------------------------------- /google_problems/problem_84.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | 3 | Yesterday you implemented a function that encodes a hexadecimal string into Base64. 4 | 5 | Write a function to decode a Base64 string back to a hexadecimal string. 6 | 7 | For example, the following string: 8 | 9 | 3q2+7w== 10 | should produce: 11 | 12 | deadbeef 13 | """ -------------------------------------------------------------------------------- /google_problems/problem_86.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | 3 | Explain the difference between composition and inheritance. In which cases would you use each? 4 | """ 5 | -------------------------------------------------------------------------------- /google_problems/problem_89.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Google. 2 | 3 | Given a string which we can delete at most k, 4 | return whether you can make a palindrome. 5 | 6 | For example, given 'waterrfetawx' and a k of 2, 7 | you could delete f and x to get 'waterretaw'. 8 | """ 9 | -------------------------------------------------------------------------------- /header_image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Younes-Charfaoui/Daily-Coding-Problem/3d3e18496b384889d4845fc4af24ecd713a0c3b6/header_image.jpg -------------------------------------------------------------------------------- /ibm_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by IBM. 2 | 3 | Given an integer, find the next permutation of it in absolute order. 4 | For example, given 48975, the next permutation would be 49578. 5 | """ -------------------------------------------------------------------------------- /ibm_problems/problem_2.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by IBM. 2 | 3 | Given a string with repeated characters, rearrange the string so that no 4 | two adjacent characters are the same. If this is not possible, return None. 5 | 6 | For example, given "aaabbc", you could return "ababac". Given "aaab", return None. 7 | """ -------------------------------------------------------------------------------- /indeed_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Indeed. 2 | 3 | Given a 32-bit positive integer N, 4 | determine whether it is a power of four in faster than O(log N) time. 5 | """ -------------------------------------------------------------------------------- /jane_street_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Jane Street. 2 | 3 | cons(a, b) constructs a pair, and car(pair) and cdr(pair) returns the first and 4 | last element of that pair. For example, car(cons(3, 4)) returns 3, 5 | and cdr(cons(3, 4)) returns 4. 6 | 7 | Given this implementation of cons: 8 | 9 | def cons(a, b): 10 | def pair(f): 11 | return f(a, b) 12 | return pair 13 | Implement car and cdr.""" -------------------------------------------------------------------------------- /jane_street_problems/problem_3.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Jane Street. 2 | Generate a finite, but an arbitrarily large binary tree quickly in O(1). 3 | That is, generate() should return a tree whose size is unbounded but finite. 4 | """ -------------------------------------------------------------------------------- /jane_street_problems/problem_6.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Jane Street. 2 | 3 | Given integers M and N, write a program that counts how many positive 4 | integer pairs (a, b) satisfy the following conditions: 5 | 6 | a + b = M 7 | a XOR b = N 8 | """ -------------------------------------------------------------------------------- /linked_in_problems/problem_3.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by LinkedIn. 2 | Given a list of points, a central point, and an integer k, find the nearest k points from the central point. 3 | For example, given the list of points [(0, 0), (5, 4), (3, 1)], the central point (1, 2), 4 | and k = 2, return [(0, 0), (3, 1)]. 5 | 6 | """ 7 | -------------------------------------------------------------------------------- /lyft_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Lyft. 2 | Given a list of integers and a number K, return which contiguous elements of the list sum to K. 3 | For example, if the list is [1, 2, 3, 4, 5] and K is 9, then it should return [2, 3, 4]. 4 | """ -------------------------------------------------------------------------------- /microsoft_problems/problem_10.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Microsoft. 2 | Given a number in the form of a list of digits, return all possible permutations. 3 | For example, given [1,2,3], return [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]. 4 | """ -------------------------------------------------------------------------------- /microsoft_problems/problem_11.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Microsoft. 2 | Given an unsorted array of integers, find the length of 3 | the longest consecutive elements sequence. 4 | For example, given [100, 4, 200, 1, 3, 2], the longest consecutive 5 | element sequence is [1, 2, 3, 4]. Return its length: 4. 6 | Your algorithm should run in O(n) complexity. 7 | """ -------------------------------------------------------------------------------- /microsoft_problems/problem_12.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Microsoft. 2 | 3 | Print the nodes in a binary tree level-wise. For example, the following should print 4 | 1, 2, 3, 4, 5. 5 | 6 | 1 7 | / \ 8 | 2 3 9 | / \ 10 | 4 5 11 | """ -------------------------------------------------------------------------------- /microsoft_problems/problem_14.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Microsoft. 2 | 3 | You have 100 fair coins and you flip them all at the same time. 4 | Any that come up tails you set aside. The ones that come up heads you flip again. 5 | How many rounds do you expect to play before only one coin remains? 6 | 7 | Write a function that, given n, returns the number of rounds you'd expect to play until one coin remains. 8 | """ 9 | -------------------------------------------------------------------------------- /microsoft_problems/problem_16.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Microsoft. 2 | 3 | Implement 3 stacks using a single list: 4 | 5 | class Stack: 6 | def __init__(self): 7 | self.list = [] 8 | 9 | def pop(self, stack_number): 10 | pass 11 | 12 | def push(self, item, stack_number): 13 | pass 14 | """ 15 | -------------------------------------------------------------------------------- /microsoft_problems/problem_17.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Microsoft. 2 | 3 | Describe and give an example of each of the following types of polymorphism: 4 | 5 | Ad-hoc polymorphism 6 | Parametric polymorphism 7 | Subtype polymorphism 8 | """ 9 | -------------------------------------------------------------------------------- /microsoft_problems/problem_18.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Microsoft. 2 | 3 | Given an array of positive integers, divide the array into two subsets such 4 | that the difference between the sum of the subsets is as small as possible. 5 | 6 | For example, given [5, 10, 15, 20, 25], return the sets {10, 25} and {5, 15, 20}, 7 | which has a difference of 5, which is the smallest possible difference. 8 | """ 9 | -------------------------------------------------------------------------------- /microsoft_problems/problem_19.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Microsoft. 2 | 3 | Let X be a set of n intervals on the real line. We say that a set of points P "stabs" 4 | X if every interval in X contains at least one point in P. 5 | Compute the smallest set of points that stabs X. 6 | 7 | For example, given the intervals [(1, 4), (4, 5), (7, 9), (9, 12)], you should return [4, 9]. 8 | """ 9 | -------------------------------------------------------------------------------- /microsoft_problems/problem_20.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Microsoft. 2 | 3 | Given a string and a pattern, find the starting indices of all occurrences 4 | of the pattern in the string. For example, given the string "abracadabra" and 5 | the pattern "abr", you should return [0, 7]. 6 | """ 7 | -------------------------------------------------------------------------------- /microsoft_problems/problem_21.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Microsoft. 2 | 3 | Recall that the minimum spanning tree is the subset of edges of a tree that connect all 4 | its vertices with the smallest possible total edge weight. 5 | Given an undirected graph with weighted edges, compute the maximum weight spanning tree. 6 | """ 7 | -------------------------------------------------------------------------------- /microsoft_problems/problem_24.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Microsoft. 2 | 3 | Given a clock time in hh:mm format, determine, to the nearest degree, the angle between the 4 | hour and the minute hands. 5 | 6 | Bonus: When, during the course of a day, will the angle be zero? 7 | """ 8 | -------------------------------------------------------------------------------- /microsoft_problems/problem_25.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Microsoft. 2 | 3 | Write a program to determine how many distinct ways there are to create a max heap 4 | from a list of N given integers. 5 | 6 | For example, if N = 3, and our integers are [1, 2, 3], there are two ways, shown below. 7 | 8 | 3 3 9 | / \ / \ 10 | 1 2 2 1 11 | """ 12 | -------------------------------------------------------------------------------- /microsoft_problems/problem_26.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Microsoft. 2 | 3 | Given an array of numbers and a number k, determine if there are three entries in 4 | the array which add up to the specified number k. 5 | For example, given [20, 303, 3, 4, 25] and k = 49, return true as 20 + 4 + 25 = 49. 6 | """ 7 | -------------------------------------------------------------------------------- /microsoft_problems/problem_28.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Microsoft. 2 | 3 | Given a string, generate all possible subsequences of the string. 4 | 5 | For example, given the string xyz, return an array or set with the following strings: 6 | 7 | 8 | x 9 | y 10 | z 11 | xy 12 | xz 13 | yz 14 | xyz 15 | 16 | Note that zx is not a valid subsequence since it is not in the order of the given string. 17 | """ 18 | -------------------------------------------------------------------------------- /microsoft_problems/problem_3.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Microsoft. 2 | You have an N by N board. Write a function that, given N, returns the 3 | number of possible arrangements of the board where N queens can be placed on the board 4 | without threatening each other, 5 | i.e. no two queens share the same row, column, or diagonal.""" -------------------------------------------------------------------------------- /microsoft_problems/problem_8.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Microsoft. 2 | Given an array of numbers, find the length of the longest increasing subsequence in the array. 3 | The subsequence does not necessarily have to be contiguous. 4 | For example, given the array [0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15], 5 | the longest increasing subsequence has length 6: it is 0, 2, 6, 9, 11, 15. 6 | """ -------------------------------------------------------------------------------- /microsoft_problems/problem_9.py: -------------------------------------------------------------------------------- 1 | """This problem was asked Microsoft. 2 | Using a read7() method that returns 7 characters from a file, implement readN(n) which reads n characters. 3 | For example, given a file with the content “Hello world”, three read7() returns “Hello w”, “orld” and then “”. 4 | """ -------------------------------------------------------------------------------- /mongo_db_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by MongoDB. 2 | 3 | Given a list of elements, find the majority element, 4 | which appears more than half the times (> floor(len(lst) / 2.0)). 5 | 6 | You can assume that such element exists. 7 | For example, given [1, 2, 1, 1, 3, 4, 0], return 1. 8 | """ -------------------------------------------------------------------------------- /mozila_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Mozilla. 2 | 3 | A bridge in a connected (undirected) graph is an edge that, 4 | if removed, causes the graph to become disconnected. 5 | Find all the bridges in a graph. 6 | """ -------------------------------------------------------------------------------- /netflix_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Netflix. 2 | 3 | Given a sorted list of integers of length N, determine if an element x is in the 4 | list without performing any multiplication, division, or bit-shift operations. 5 | 6 | Do this in O(log N) time 7 | """ 8 | -------------------------------------------------------------------------------- /netflix_problems/problem_2.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Netflix. 2 | 3 | Given an array of integers, determine whether it contains a Pythagorean triplet. 4 | Recall that a Pythogorean triplet (a, b, c) is defined by the equation a2+ b2= c2. 5 | """ 6 | -------------------------------------------------------------------------------- /netflix_problems/problem_4.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Netflix. 2 | 3 | Implement a queue using a set of fixed-length arrays. 4 | 5 | The queue should support enqueue, dequeue, and get_size operations. 6 | """ 7 | -------------------------------------------------------------------------------- /nextdoor_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Nextdoor. 2 | 3 | Implement integer division without using the division operator. 4 | Your function should return a tuple of (dividend, remainder) and 5 | it should take two numbers, the product and divisor. 6 | 7 | For example, calling divide(10, 3) should return (3, 1) since the 8 | divisor is 3 and the remainder is 1. 9 | 10 | Bonus: Can you do it in O(log n) time? 11 | """ -------------------------------------------------------------------------------- /nvidia_problems/problem_2.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Nvidia. 2 | 3 | Find the maximum of two numbers without using any 4 | if-else statements, branching, or direct comparisons. 5 | """ 6 | -------------------------------------------------------------------------------- /oracle_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Oracle. 2 | 3 | We say a number is sparse if there are no adjacent ones in its binary representation. 4 | For example, 21 (10101) is sparse, but 22 (10110) is not. 5 | For a given input N, find the smallest sparse number greater than or equal to N. 6 | 7 | Do this in faster than O(N log N) time. 8 | """ 9 | -------------------------------------------------------------------------------- /oracle_problems/problem_3.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Oracle. 2 | 3 | Given a binary search tree, find the floor and ceiling of a given integer. 4 | The floor is the highest element in the tree less than or equal to an integer, 5 | while the ceiling is the lowest element in the tree greater than or equal to an integer. 6 | 7 | If either value does not exist, return None. 8 | """ 9 | -------------------------------------------------------------------------------- /others_problems/problem_2.py: -------------------------------------------------------------------------------- 1 | """Given a real number n, find the square root of n. For example, given n = 9, return 3. 2 | """ 3 | 4 | def square_root(x): 5 | return x**(1/2) -------------------------------------------------------------------------------- /others_problems/problem_3.py: -------------------------------------------------------------------------------- 1 | """Given a list, sort it using this method: reverse(lst, i, j), which sorts lst from i to j.""" -------------------------------------------------------------------------------- /others_problems/problem_4.py: -------------------------------------------------------------------------------- 1 | """Given a 2-D matrix representing an image, a location of a pixel in the screen and a color C, 2 | replace the color of the given pixel and all adjacent same colored pixels with C. 3 | For example, given the following matrix, and location pixel of (2, 2), and 'G' for green: 4 | B B W 5 | W W W 6 | W W W 7 | B B B 8 | Becomes 9 | B B G 10 | G G G 11 | G G G 12 | B B B 13 | """ -------------------------------------------------------------------------------- /others_problems/problem_5.py: -------------------------------------------------------------------------------- 1 | """Find an efficient algorithm to find the smallest distance 2 | (measured in number of words) between any two given words in a string. 3 | For example, given words "hello", and "world" and a text 4 | content of "dog cat hello cat dog dog hello cat world", return 1 because 5 | there's only one word "cat" in between the two words. 6 | """ -------------------------------------------------------------------------------- /others_problems/problem_6.py: -------------------------------------------------------------------------------- 1 | """A number is considered deficient if the sum of its factor is less than twice that 2 | number. write a program to verify whether a given number is deficient or not. 3 | Bonus: write a program to find all the deficient number in a range. 4 | """ -------------------------------------------------------------------------------- /others_problems/problem_8.py: -------------------------------------------------------------------------------- 1 | """You are given an integer, . Write a program to determine if is an element of the Fibonacci sequence. 2 | 3 | The first few elements of the Fibonacci sequence are . A Fibonacci sequence is one where every element is a sum of the previous two elements in the sequence. The first two elements are and . 4 | """ -------------------------------------------------------------------------------- /others_problems/problem_9.py: -------------------------------------------------------------------------------- 1 | """Create a program that checks if a given string expression 2 | all the parentheses are balanced. 3 | """ -------------------------------------------------------------------------------- /palantir_problems/problem_3.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Palantir. 2 | 3 | Write a program that checks whether an integer is a palindrome. For example, 121 is a palindrome, 4 | as well as 888. 678 is not a palindrome. Do not convert the integer into a string. 5 | """ -------------------------------------------------------------------------------- /palantir_problems/problem_4.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Palantir. 2 | 3 | Typically, an implementation of in-order traversal of a binary tree has O(h) space complexity, 4 | where h is the height of the tree. 5 | Write a program to compute the in-order traversal of a binary tree using O(1) space. 6 | """ -------------------------------------------------------------------------------- /palantir_problems/problem_6.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Palantir. 2 | 3 | The ancient Egyptians used to express fractions as a sum of several terms where each numerator is one. 4 | For example, 4 / 13 can be represented as 1 / 4 + 1 / 18 + 1 / 468. 5 | 6 | Create an algorithm to turn an ordinary fraction a / b, where a < b, into an Egyptian fraction. 7 | """ -------------------------------------------------------------------------------- /palantir_problems/problem_7.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Palantir. 2 | 3 | You are given a list of N numbers, in which each number is located at most k places away from 4 | its sorted position. For example, if k = 1, a given element at index 4 might end up at 5 | indices 3, 4, or 5. 6 | 7 | Come up with an algorithm that sorts this list in O(N log k) time. 8 | """ -------------------------------------------------------------------------------- /panadora_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Pandora. 2 | 3 | Given an undirected graph, determine if it contains a cycle. 4 | """ -------------------------------------------------------------------------------- /paypal_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """ 2 | This problem was asked by PayPal. 3 | 4 | Given a binary tree, determine whether or not it is height-balanced. 5 | A height-balanced binary tree can be defined as one in which the heights of the two subtrees of 6 | any node never differ by more than one.""" -------------------------------------------------------------------------------- /paypal_problems/problem_3.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Paypal. 2 | 3 | Read this Wikipedia article on Base64 encoding. 4 | 5 | Implement a function that converts a hex string to base64. 6 | 7 | For example, the string: 8 | 9 | deadbeef 10 | should produce: 11 | 12 | 3q2+7w== 13 | """ -------------------------------------------------------------------------------- /pinterest_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Pinterest. 2 | 3 | Given an integer list where each number represents the number of hops you can make, 4 | determine whether you can reach to the last index starting at index 0. 5 | 6 | For example, [2, 0, 1, 0] returns true while [1, 1, 0, 1] returns false. 7 | """ -------------------------------------------------------------------------------- /pinterest_problems/problem_2.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Pinterest. 2 | 3 | The sequence [0, 1, ..., N] has been jumbled, and the only clue you have for its order 4 | is an array representing whether each number is larger or smaller than the last. 5 | Given this information, reconstruct an array that is consistent with it. 6 | For example, given [None, +, +, -, +], you could return [1, 2, 3, 0, 4] 7 | """ -------------------------------------------------------------------------------- /pinterest_problems/problem_4.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Pinterest. 2 | 3 | 4 | Given a binary tree, write a function to determine whether the tree is a 5 | mirror image of itself. 6 | Two trees are a mirror image if their root values are the same and the 7 | left subtree is a mirror image of the right subtree. 8 | """ -------------------------------------------------------------------------------- /pivotal_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Pivotal. 2 | 3 | A step word is formed by taking a given word, adding a letter, and anagramming the result. 4 | For example, starting with the word "APPLE", you can add an "A" and anagram to get "APPEAL". 5 | 6 | Given a dictionary of words and an input word, 7 | create a function that returns all valid step words. 8 | """ -------------------------------------------------------------------------------- /pivotal_problems/problem_2.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Pivotal. 2 | 3 | Write an algorithm that finds the total number of 4 | set bits in all integers between 1 and N. 5 | """ -------------------------------------------------------------------------------- /quora_problems/problem_2.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Quora. 2 | 3 | Given an absolute pathname that may have . or .. as part of it, 4 | return the shortest standardized path. 5 | 6 | For example, given "/usr/bin/../bin/./scripts/../", return "/usr/bin/". 7 | """ -------------------------------------------------------------------------------- /robinhood_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Robinhood. 2 | 3 | Given an array of strings, group anagrams together. 4 | 5 | For example, given the following array: 6 | 7 | ['eat', 'ate', 'apt', 'pat', 'tea', 'now'] 8 | Return: 9 | 10 | [['eat', 'ate', 'tea'], 11 | ['apt', 'pat'], 12 | ['now']] 13 | """ 14 | -------------------------------------------------------------------------------- /robinhood_problems/problem_2.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Robinhood. 2 | 3 | Given a number n, return the number of lists of consecutive numbers that sum up to n. 4 | 5 | For example, for n = 9, you should return 3 since the 6 | lists are: [2, 3, 4], [4, 5], and [9]. Can you do it in linear time? 7 | """ 8 | -------------------------------------------------------------------------------- /salesforce_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Salesforce. 2 | 3 | Connect 4 is a game where opponents take turns dropping red or black discs into a 7 x 6 vertically suspended grid. 4 | The game ends either when one player creates a line of four consecutive discs of their 5 | color (horizontally, vertically, or diagonally), or when there are no more spots left in the grid. 6 | 7 | Design and implement Connect 4. 8 | """ -------------------------------------------------------------------------------- /salesforce_problems/problem_2.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Salesforce. 2 | 3 | Given an array of integers, find the maximum XOR of any two elements. 4 | """ -------------------------------------------------------------------------------- /salesforce_problems/problem_4.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Salesforce. 2 | 3 | Write a program to merge two binary trees. Each node in the new tree should hold a value 4 | equal to the sum of the values of the corresponding nodes of the input trees. 5 | 6 | If only one input tree has a node in a given position, the corresponding node in the new 7 | tree should match that input node. 8 | """ -------------------------------------------------------------------------------- /snapchat_problems/problem_3.py: -------------------------------------------------------------------------------- 1 | """This question was asked by Snapchat. 2 | 3 | Given the head to a singly linked list, 4 | where each node also has a “random” pointer that points 5 | to anywhere in the linked list, deep clone the list. 6 | """ -------------------------------------------------------------------------------- /snapchat_problems/problem_4.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Snapchat. 2 | 3 | Given a string of digits, generate all possible valid IP address combinations. 4 | 5 | IP addresses must follow the format A.B.C.D, where A, B, C, and D are numbers between 0 and 255. 6 | Zero-prefixed numbers, such as 01 and 065, are not allowed, except for 0 itself. 7 | 8 | For example, given "2542540123", you should return ['254.25.40.123', '254.254.0.123']. 9 | """ -------------------------------------------------------------------------------- /spotify_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """ 2 | Good morning! Here's your coding interview problem for today. 3 | 4 | This problem was asked by Spotify. 5 | 6 | There are N couples sitting in a row of length 2 * N. They are currently ordered randomly, 7 | but would like to rearrange themselves so that each couple's partners can sit side by side. 8 | 9 | What is the minimum number of swaps necessary for this to happen? 10 | """ -------------------------------------------------------------------------------- /spotify_problems/problem_2.py: -------------------------------------------------------------------------------- 1 | """ 2 | This problem was asked by Spotify. 3 | 4 | Write a function, throw_dice(N, faces, total), that determines how many ways it is possible to 5 | throw N dice with some number of faces each to get a specific total. 6 | 7 | For example, throw_dice(3, 6, 7) should equal 15. 8 | """ -------------------------------------------------------------------------------- /square_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Square. 2 | Assume you have access to a function toss_biased() which returns 0 or 1 with 3 | a probability that's not 50-50 (but also not 0-100 or 100-0). 4 | You do not know the bias of the coin. 5 | Write a function to simulate an unbiased coin toss. 6 | """ 7 | -------------------------------------------------------------------------------- /square_problems/problem_2.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Square. 2 | Given a string and a set of characters, return the shortest substring containing all the characters in the set. 3 | For example, given the string "figehaeci" and the set of characters {a, e, i}, you should return "aeci". 4 | If there is no substring containing all the characters in the set, return null. 5 | """ 6 | -------------------------------------------------------------------------------- /square_problems/problem_3.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Square. 2 | Given a list of words, return the shortest unique prefix of each word. For example, given the list: 3 | • dog 4 | • cat 5 | • apple 6 | • apricot 7 | • fish 8 | Return the list: 9 | • d 10 | • c 11 | • app 12 | • apr 13 | • f 14 | """ 15 | -------------------------------------------------------------------------------- /squarespace_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Squarespace. 2 | 3 | Write a function, add_subtract, which alternately adds and subtracts curried arguments. 4 | Here are some sample operations: 5 | 6 | add_subtract(7) -> 7 7 | 8 | add_subtract(1)(2)(3) -> 1 + 2 - 3 -> 0 9 | 10 | add_subtract(-5)(10)(3)(9) -> -5 + 10 - 3 + 9 -> 11 11 | """ 12 | -------------------------------------------------------------------------------- /stripe_problems/problem_5.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Stripe. 2 | 3 | Given an integer n, return the length of the longest 4 | consecutive run of 1s in its binary representation. 5 | 6 | For example, given 156, you should return 3. 7 | """ -------------------------------------------------------------------------------- /sumo_logic_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Sumo Logic. 2 | 3 | Given an unsorted array, in which all elements are distinct, find a "peak" element in O(log N) time. 4 | 5 | An element is considered a peak if it is greater than both its left and right neighbors. 6 | It is guaranteed that the first and last elements are lower than all others. 7 | """ 8 | -------------------------------------------------------------------------------- /twitch_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Twitch. 2 | 3 | Describe what happens when you type a URL into your browser and press Enter. 4 | """ 5 | -------------------------------------------------------------------------------- /twitter_problems/problem_11.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Twitter. 2 | 3 | A strobogrammatic number is a positive number that appears the same 4 | after being rotated 180 degrees. For example, 16891 is strobogrammatic. 5 | 6 | Create a program that finds all strobogrammatic numbers with N digits. 7 | """ -------------------------------------------------------------------------------- /twitter_problems/problem_12.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Twitter. 2 | 3 | Given a string, sort it in decreasing order based on the frequency of characters. 4 | If there are multiple possible solutions, return any of them. 5 | 6 | For example, given the string tweet, return tteew. eettw would also be acceptable. 7 | 8 | """ -------------------------------------------------------------------------------- /twitter_problems/problem_14.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Twitter. 2 | 3 | A strobogrammatic number is a positive number that appears the same 4 | after being rotated 180 degrees. For example, 16891 is strobogrammatic. 5 | 6 | Create a program that finds all strobogrammatic numbers with N digits. 7 | """ -------------------------------------------------------------------------------- /twitter_problems/problem_5.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Twitter. 2 | 3 | Given a list of numbers, create an algorithm that arranges them in order to form the largest possible integer. 4 | For example, given [10, 7, 76, 415], you should return 77641510.""" -------------------------------------------------------------------------------- /two_sigma_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Two Sigma. 2 | Using a function rand5() that returns an integer 3 | from 1 to 5 (inclusive) with uniform probability, 4 | implement a function rand7() that returns 5 | an integer from 1 to 7 (inclusive). 6 | """ -------------------------------------------------------------------------------- /two_sigma_problems/problem_2.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Two Sigma. 2 | Using a function rand7() that returns an integer from 1 to 7 (inclusive) with uniform probability, 3 | implement a function rand5() that returns an integer from 1 to 5 (inclusive). 4 | """ -------------------------------------------------------------------------------- /two_sigma_problems/problem_5.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Two Sigma. 2 | 3 | A knight is placed on a given square on an 8 x 8 chessboard. It is then moved randomly 4 | several times, where each move is a standard knight move. If the knight jumps off the 5 | board at any point, however, it is not allowed to jump back on. 6 | 7 | After k moves, what is the probability that the knight remains on the board? 8 | """ -------------------------------------------------------------------------------- /two_sigma_problems/problem_8.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Two Sigma. 2 | 3 | You are given an unsorted list of 999,000 unique integers, each from 1 and 1,000,000. 4 | Find the missing 1000 numbers. What is the computational and space complexity of your solution? 5 | """ -------------------------------------------------------------------------------- /two_sigma_problems/problem_9.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Two Sigma. 2 | 3 | Using a function rand5() that returns an integer from 1 to 5 (inclusive) with 4 | uniform probability, implement a function rand7() that returns an integer 5 | from 1 to 7 (inclusive). 6 | """ -------------------------------------------------------------------------------- /uber_problems/problem_10.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Uber. 2 | 3 | Write a program that determines the smallest number of perfect 4 | squares that sum up to N. 5 | 6 | Here are a few examples: 7 | 8 | - Given N = 4, return 1 (4) 9 | - Given N = 17, return 2 (16 + 1) 10 | - Given N = 18, return 2 (9 + 9) 11 | """ -------------------------------------------------------------------------------- /uber_problems/problem_11.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Uber. 2 | 3 | Given a binary tree and an integer k, return whether there exists a root-to-leaf 4 | path that sums up to k. 5 | 6 | For example, given k = 18 and the following binary tree: 7 | 8 | 8 9 | / \ 10 | 4 13 11 | / \ \ 12 | 2 6 19 13 | Return True since the path 8 -> 4 -> 6 sums to 18. 14 | """ -------------------------------------------------------------------------------- /uber_problems/problem_5.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Uber. 2 | Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. 3 | Find the minimum element in O(log N) time. You may assume the array does not contain duplicates. 4 | For example, given [5, 7, 10, 3, 4], return 3. 5 | """ -------------------------------------------------------------------------------- /uber_problems/problem_8.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Uber. 2 | 3 | On election day, a voting machine writes data in the form (voter_id, candidate_id) to a text file. 4 | Write a program that reads this file as a stream and returns the top 3 candidates at any given time. 5 | If you find a voter voting more than once, report this as fraud. 6 | """ -------------------------------------------------------------------------------- /whatsup_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by WhatsApp. 2 | 3 | Given an array of integers out of order, determine the bounds 4 | of the smallest window that must be sorted in order for the 5 | entire array to be sorted. 6 | For example, given [3, 7, 5, 6, 9], you should return (1, 3). 7 | """ -------------------------------------------------------------------------------- /yahoo_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Yahoo. 2 | 3 | Write an algorithm that computes the reversal of a directed graph. 4 | For example, if a graph consists of A -> B -> C, it should become A <- B <- C. 5 | """ -------------------------------------------------------------------------------- /yahoo_problems/problem_3.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Yahoo. 2 | 3 | Write a function that returns the bitwise AND of all integers between M and N, inclusive. 4 | """ -------------------------------------------------------------------------------- /yelp_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Yelp. 2 | 3 | Given a mapping of digits to letters (as in a phone number), and a digit string, 4 | return all possible letters the number could represent. You can assume each 5 | valid number in the mapping is a single digit. 6 | For example if {“2”: [“a”, “b”, “c”], 3: [“d”, “e”, “f”], …} 7 | then “23” should return [“ad”, “ae”, “af”, “bd”, “be”, “bf”, “cd”, “ce”, “cf"]. 8 | """ -------------------------------------------------------------------------------- /yext_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Yext. 2 | 3 | Two nodes in a binary tree can be called cousins if they are on the same 4 | level of the tree but have different parents. For example, in the following 5 | diagram 4 and 6 are cousins. 6 | 7 | 1 8 | / \ 9 | 2 3 10 | / \ \ 11 | 4 5 6 12 | Given a binary tree and a particular node, find all cousins of that node. 13 | """ -------------------------------------------------------------------------------- /youtube_problems/problem_1.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by YouTube. 2 | Write a program that computes the length of the 3 | longest common subsequence of three given strings. 4 | For example, given "epidemiologist", "refrigeration", and "supercalifragilisticexpialodocious", 5 | it should return 5, since the longest common subsequence is "eieio". 6 | """ -------------------------------------------------------------------------------- /zillow_problems/problem_2.py: -------------------------------------------------------------------------------- 1 | """This problem was asked by Zillow. 2 | 3 | Let's define a "sevenish" number to be one which is either a power of 7, or the sum of unique powers of 7. 4 | The first few sevenish numbers are 1, 7, 8, 49, and so on. 5 | Create an algorithm to find the nth sevenish number. 6 | """ --------------------------------------------------------------------------------