Skip to content
Paras Gupta

Jan 11 - Daily Programming Diary

Diary, Programming, LocalHackDay1 min read

16:00

I know what you wanna say - Wake up early! This is no way to live. Agreed!

Anyway I submitted a couple of challenges in MLH LocalHackDay and just completed the Leetcode Daily Challenge. Had to merge two sorted arrays in the first array. I looked at the constraints and my immediate reaction was 200 elements, that's too low so I implemented the way we merge arrays but the inplace thing turned out to be more challenging that it initially seemed. So I merged the two arrays together and did the sort on them since you know, 200.

merge-sorted-array.cpp
1void merge(vector<int> &nums1, int m, vector<int> &nums2, int n) {
2 if (n == 0) return;
3
4 for (int i = 0; i < n; i++) {
5 nums1[m + i] = nums2[i];
6 }
7
8 sort(nums1.begin(), nums1.end());
9 return;
10}
23:30

I didn't write a lot today. Most of the time I was working on MLH Local Hack Day. I have 15 points on Day 1. Could this BE any better!?

Anyway it's already 00:30 on 12th, so I'll go and work on Raahee Blog now.

EOD Checklist

  • Leetcode January Challenge
  • Raahee (Just attended the meeting)
  • This blog
© 2022 by Paras Gupta. All rights reserved.
Theme by LekoArts