You cannot make progress without making decisions.
Overview
We have to make decisions
each and every day of our lives. Sometimes we might get stuck endlessly thinking about what action to take. Say working on n
number of tasks and not sure which one to prioritise and we end up doing half-baked work (we all must have been in this scenario once in a while).
The below matrix helps us to make careful decisions
and also to learn the relationship between important and urgent
.
We should evaluate the tasks
that are given to us and try to maximise our potential
with the matrix framework.
Why and how this framework might be handy? Let's take a quick example by applying this matrix. Let's say I'm a youtube content creator.
If I have to make video content tomorrow, I should be doing it right away since it is more important and urgent. (
DO NOW
)We need to edit the video after we are done with the shooting work. Since it is urgent, we can delegate those works and we can purely focus on video creation. (
DELEGATE
)Since we have delegated some parts (editing, fine-tuning) of the content creation, we can look for ideas ๐ก for the next video. (
DECIDE
)If there are some other works which are neither important nor urgent, we can ignore those. (
DELETE
)
References
The below video clearly explains how to apply the Eisenhower matrix in our life.
Bonus content
Question 6:
Explanation:
Have 2 references to the head pointer. (
head1
andhead2
)Move one pointer (
head2
) to n number of steps.Move another pointer (
head1
) along with the current pointer till the current becomes null.
Check if the pointer is the same as the head node.
If so, handle it by
deleting the head pointer
to the next.If not, just ignore the node to delete it by keeping the
previous reference
andpointing it to the current node's
next.
Solution:
/**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode() {}
* ListNode(int val) { this.val = val; }
* ListNode(int val, ListNode next) { this.val = val; this.next = next; }
* }
*/
class Solution {
public ListNode removeNthFromEnd(ListNode head, int n) {
ListNode prev = null, head1 = head, head2 = head;
// Move one pointer to the given 'n' count.
for (int i=0; i<n; i++) {
head2 = head2.next;
}
// Move both the pointers till the 2nd pointer becomes null.
while (head2!= null) {
prev = head1;
head1 = head1.next;
head2 = head2.next;
}
// If the node we need to delete is the head, we just handle it by returning the next node as head.
if (head1 == head) {
return head1.next;
}
// Remove the node with the help of previous node reference.
prev.next = head1.next;
return head;
}
}
Next problem:
In the next post, I will cover the below problem.