about | help | code help+videos | done | prefs |
From a Facebook interview (summer intern): Given a hypothetical long bread, which has some strawberries in it at some random places. You can only cut the bread in places where slices are marked to cut. You are also given N, which is the number of cuts you can make in the bread. Now given N and number of strawberries in the bread in the form of array of integers, you have to return True if there is a way to divide the bread in N+1 parts, such that each section has equal number of strawberries. Otherwise return False. Example: *Bread: [1,2,1], N = 2, Result: False* *Bread: [1,1,1], N = 2, Result: True* cutBread([1, 2, 0, 3, 0], 1) → true cutBread([1, 2, 3, 3], 2) → true cutBread([1, 2, 1], 2) → false ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 200 Post-solution available
Copyright Nick Parlante 2017 - privacy