unreasonably effective

you can be sloppy, as long as you are rigorous

  • LeetCode 24: Swap Nodes in Pairs

    link With four pointers (a, b, c, d) we can swap (b, c) in-place. Since head might change, we introduce a dummy node to simplify edge-case handling. Time: , space: .

    tanvirdotzaman

    April 24, 2025
    foundational_interview, in_place_modification_linked_list
  • LeetCode 1474: Delete N Nodes After M Nodes of a Linked List

    link With (prev, curr) pointers, we skip nodes and then delete nodes. Time: , space: .

    tanvirdotzaman

    April 24, 2025
    foundational_interview, in_place_modification_linked_list
  • LeetCode 725: Split Linked List in Parts

    link First we find the expected group sizes from the length of the list and k and then copy the heads of the groups as we do a second pass. Time: , space: .

    tanvirdotzaman

    April 24, 2025
    foundational_interview, in_place_modification_linked_list
  • LeetCode 2074: Reverse Nodes in Even Length Groups

    link Two pass We first collect the groups in a list and then connect the groups. If a group has even size we also reverse it. Time: , space: . One pass For the groups we have two types of operations: If the count of nodes processed by an operation is smaller than the expected…

    tanvirdotzaman

    April 23, 2025
    foundational_interview, in_place_modification_linked_list
  • LeetCode 92: Reverse Linked List II

    link One pass We jump to the left node and reverse (right-left+1) number of nodes. We then fix two pointers: To simplify the (prev, curr) logic we introduce a dummy node. Time: , space: .

    tanvirdotzaman

    April 23, 2025
    foundational_interview, in_place_modification_linked_list
  • LeetCode 25: Reverse Nodes in k-Group

    link Two pass From the length of the list we find how many -groups need to be reversed and we reverse each -group in sequence. While reversing a -group, we have two types of operations: Time: , space: . One pass While reversing a -group, if nodes got reversed where , we know we have…

    tanvirdotzaman

    April 23, 2025
    foundational_interview, in_place_modification_linked_list
  • Distributed Systems: Consistency Tradeoffs

    CAP A partition-tolerant distributed database system continues to work in the face of network partition. Modern distributed database systems are partition-tolerant. In the face of network partition, the system can tradeoff between consistency and availability. When network becomes partitioned, a CP system chooses consistency over availability and an AP system chooses availability over consistency. How…

    tanvirdotzaman

    April 22, 2025
    distributed_system
  • LeetCode 621: Task Scheduler

    link Note len(tasks)is the lower bound for interval count. If all tasks are distinct, scheduling them in any order achieves the lower bound. However, when some tasks are repeated, we may need to insert idle cycles to cool the CPU down. With repeated tasks, if possible, we should put two instances of the same task…

    tanvirdotzaman

    April 22, 2025
    foundational_interview, merge_intervals
  • LeetCode 253: Meeting Rooms II

    link We schedule meetings in order of their start times. If there is a free room, we use it or we declare a new room is required. Say we are trying to schedule the -th meeting and currently there are meeting rooms with earlier meetings scheduled. Which among these rooms would be the most likely…

    tanvirdotzaman

    April 22, 2025
    foundational_interview, merge_intervals
  • LeetCode 759: Employee Free Time

    link Pre-sort A single employee’s free times are the gaps between consecutive work intervals. For more than one employees, we can merge overlapping work intervals and have a list of disjoint work intervals across all employees. Then, free times once again would be the gaps between consecutive work intervals. Say there are employees and the…

    tanvirdotzaman

    April 22, 2025
    foundational_interview, merge_intervals
Previous Page
1 2 3 4 5 6 … 30
Next Page

Blog at WordPress.com.

  • Subscribe Subscribed
    • unreasonably effective
    • Already have a WordPress.com account? Log in now.
    • unreasonably effective
    • Subscribe Subscribed
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar