Home
Titze's Learning Logs
Cancel

Pascal's Triangle II

View Pascal’s Triangle II on LeetCode Statistics Time Spent Coding 10 minutes Time Complexity O(n) - The algorithm iterates from 0 to rowIndex-1, which were are taking to be n, resulting in the ...

Shifting Letters

View Shifting Letters on LeetCode Statistics Time Spent Coding 20 minutes Time Complexity O(n + m) - The algorithm iterates through both lists, although at the same time, it must still access tw...

Number of Arithmetic Triplets

View Number of Arithmetic Triplets on LeetCode Statistics Time Complexity O(n) - Every number in the input list is iterated over, resulting in the O(n) time complexity. Space Complexity O(n) - E...

Number of Good Pairs

View Number of Good Pairs on LeetCode Statistics Time Spent Coding 10 minutes Time Complexity O(n) - Each element in the input list is visited once, resulting in the O(n) time complexity. Space...

Buy Two Chocolates

View Buy Two Chocolates on LeetCode Statistics Time Spent Coding 2 minutes Time Complexity O(n) - Three O(n) operations are performed, but big-O represents the growth rate and not the exact mult...

Rotate List

View Rotate List on LeetCode Statistics Time Spent Coding 20 minutes Time Complexity O(n) - Although the algorithm iterates through each node at most twice, each iteration performs only O(1) ope...

Swap Nodes in Pairs

View Swap Nodes in Pairs on LeetCode Statistics Time Spent Coding 20 minutes Time Complexity O(n) - The algorithm must iterate through each node in the list at least once and perform O(1) operat...

Linked List Cycle

View Linked List Cycle on LeetCode Statistics Time Spent Coding 2 minutes Time Complexity O(n) - Although unknown, the entire list is iterated through until the cycle is found. If there is no cy...

Delete Node in a Linked List

View Delete Node in a Linked List on LeetCode Statistics Time Spent Coding 5 minutes Time Complexity O(1) - The number of steps executed in the algorithm is independent of the input node, result...

Remove Nth Node From End of List

View Remove Nth Node From End of List on LeetCode Statistics Time Complexity O(n) - At most, the list is iterated through once, resulting in the O(b) time complexity. Space Complexity O(1) - The...