Skip to content
Paras Gupta

Jan 5 - Daily Programming Diary

Diary, Programming1 min read

12:30

I completed the Question 5 WIPL on Codechef last night but was too tired to write here.

The concept was to try and take minimum boxes first that can make a stack on 2*k size and check if we can make individual stacks from those.
The solution can be found at 41276886.

Also got 30 points in Question 6 ANTSCHEF. Just had to use long long for the result from yesterday.

16:30

Leetcode January Challenge Day 5. Starting now!
The question is pretty simple. Just have to check the next and prev values to ensure that current element is not duplicate.

remove-duplicates-from-sorted-list-ii.cpp
1ListNode *deleteDuplicates(ListNode *head) {
2 if (!head) return head;
3
4 ListNode *ans = new ListNode(-1000);
5 ListNode *temp = ans;
6 int prev = -1000;
7 while (head->next != NULL) {
8 if (head->val != prev && head->val != head->next->val) {
9 ans->next = head;
10 ans = ans->next;
11 }
12
13 prev = head->val;
14 head = head->next;
15 }
16
17 if (head->val == prev) {
18 ans->next = NULL;
19 } else {
20 ans->next = head;
21 }
22
23 return temp->next;
24}

Time complexity O(n), space complexity O(1).

20:30

Have to work on Raahee feature tomorrow for demo on 7th. Getting the report feature ready is a large task considering the time I have. In any case, not feeling like working any more today. So I'll get back tomorrow.

Also, this blog needs a feature for me to write something and only show when I'm logged in. I mean, what if I want to write about my feelings? Gonna do that after completing the Raahee features.

Sayonara!

EOD Checklist

  • Go
  • Leetcode January Challenge
  • Codechef Long Challenge
  • Raahee
  • This blog
© 2022 by Paras Gupta. All rights reserved.
Theme by LekoArts