Saturday, July 8th
Today is Saturday, which means contest in addition to the daily problem
1. The biweekly contest was okay. The site was down for the first 30 minutes, so only had under an hour. While the first question was straightforward to understand, the implementation was a little more nuanced than what one would expect for an easy, start-of-a-contest question, and took up a lot of my available time.
The second question felt the easiest, I was able to code a solution after just a few minutes. Since the question asked for a sorted answer, I looked into utilizing a priority queue, but pq's have no erase method. So instead I used a vanilla hash table, transferred results to a vector, then sorted the vector. Sorting a vector seemed so obvious I thought I'd time out, but in fact got accepted.
I glanced at the third and fourth question, though only had a few minutes to work on them. No approach came immediately to mind, but looking at some of the other responses, there was a recursive technique for number 3 that was only a few lines.
2. The problem of the day is yet another question as of late that seems like a Dynamic Programming problem when in fact it is much simpler. The trick is to observe that only the end points of the subarray get counted, so we can create an array of n-1 length that stores all possible end point sums.
Comments
Post a Comment