Another experiment: can leetcode-esque problems provide a useful way to learn computer science topics?
This problem is about run-length-encoding. Still pretty algorithmic, but a bit more applied. Though, as I did it, it really did feel more like understanding the description more than solving the problem. On the other hand, I think this is a great “fundamentals” problem.
class Solution(object):
def decompressRLElist(self, nums):
res = []
for i in range(0, len(nums), 2):
freq = nums[i]
val = nums[i+1]
res += freq*[val]
return res