-
-
Save ShinJJang/c6940e7a67b9f8d1a10c3183f462e74b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def solution(heights): | |
diff = [] | |
for idx in range(len(heights)-1): | |
diff.insert(len(diff), heights[idx] - heights[idx+1]) | |
receives = [0] | |
for idx in range(len(diff)): | |
recv = 0 | |
for t in range(idx, -1, -1): | |
if sum(diff[t:idx+1]) > 0: | |
recv = t + 1 | |
break | |
receives.append(recv) | |
return receives |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment