Day 1-2: Improved Much More Than Before
In the last 2 days, I gave 2 contests. Each had 2 medium-hard and 2 hard questions.
Across the two contests, I couldn’t submit 3 out of the 8 questions. For 2 of them, I actually wrote code but couldn’t get it submitted in time.
And then there was this one question where I couldn’t even figure out what I was supposed to write: https://leetcode.com/problems/split-and-merge-array-transformation/
This is all I could write no code here. Even with n<=6 constraints.
Click to see my code
class Solution {
public:
int minSplitMerge(vector<int>& nums1, vector<int>& nums2) {
// what a question ok.
// so its scary but constraints they are small
// like exponential solution would work easily with n= 6
// there can be 36 subarrays of nums1. I need to mix and match them to form nums2
// but I can't be thinking in terms of subarrays that'll make it more complicated.
// but then I can't randomly change positions of any right?
// what matters here is order.
// nums1 = [1,1,2,3,4,5], nums2 = [5,4,3,2,1,1]
// 1,1 is in the correct order to begin with.
// so I can split it.
// where should it be at the end or after 2.
// which forms the longest result correct. option 2
// so merge it at 2,1,1 nums1 now is: 2,1,1,3,4,5
// what's the longest match? 2,1,1 split it.
// where should it be at the end or after 3.
// which forms the longest result correct. option 2
// so merge it as 3,2,1,1 nums1 now is: 3,2,1,1,4,5
// again longest? 3,2,1,1 split.
// where can i merge it. after 4 or at the end
// longest after 4 so 4,3,2,1,1,5
// and lastly 5 at first
// but that's 4 operations.
// min is 3.
// which means I need to explore all choices.
// but will i only explore the choices for longest one always?
// I don't think so.
// because then again. I am missing on possibilities.
// what exactly are all the possibilities?
// 2,4 and 4,2
// 2 4 2,4
// Rule 1: split the array always into two non-empty parts.
// nums1 = [3,1,2], nums2 = [1,2,3]
// 3 1 2 3,1 1,2
// ok so if for each subarray I try to remove it and place it to a spot.
// and then try and get the min of all results.
// and same the min of overall subarray choices then?
// I mean n^2 subarrays 36
// 1 picked can be placed at 6 positions at max
// so each of 36 has *6 choices 216
// but it doesn't stop there. these further create that many choices.
// which is um.
// I hope not infinite.
// ok let's try next question.
}
};One thing I don’t want to leave out is that on Day 1, I was travelling for more than 8 hours and was barely functioning health-wise. And I still managed to sit down and give the contest.
I know the amount of work I did that day doesn’t look like much on paper.
But compared to where I was before this challenge, that’s a pretty big jump.
Day 1 DBMS practice: https://chatgpt.com/share/6a956efd-7fa0-83e8-a727-af6243b258a9 [chat link as promised]
Day 2.
On this day, I gave a contest. And worked on the the project for almost a few hours. I’ll be done with the base of it by end of day.
Next up I prepared for an exam that I have in a day almost 1-2 hrs there.
Then, I practiced some more DBMS [in the same link I not too sure if it updates.] I did try with videos but they just don’t work for me anymore.
And finally, I worked on this article. Thankfully, it didn’t take too long.
Most of Day 2 was honestly about development, which I’m pretty happy about. I’m also very close to having the base of the project finished.
I also listened to a really good podcast today.
Does listening to a podcast count as progress?
Probably not.
But I’m counting it anyway.