Home
Leet Code Learning Logs
Cancel

Daily Temperatures

View Daily Temperatures on LeetCode Statistics Time Complexity O(n) - We must iterate through the temperatures list, resulting in the O(n) time complexity. Space Complexity O(n) - In the worst-c...

Arranging Coins

View Arranging Coins on LeetCode Statistics Time Spent Coding 5 minutes Time Complexity O(n log n) - The binary search algorithm takes O(n log n) time resulting in the O(n log n) time complexity...

Car Fleet

View Car Fleet on LeetCode Statistics Time Complexity O(n log n) - We must sort the array, and the built-in sorting algorithm takes O(n log n), and since this operation takes the longest time, it...

Intersection of Two Linked Lists

View Intersection of Two Linked Lists on LeetCode Statistics Time Spent Coding 5 minutes Time Complexity O(n + m) - We must iterate through each list at least once, taking n as the length of lis...

Number of Segments in a String

View Number of Segments in a String on LeetCode Statistics Time Spent Coding 20 seconds Time Complexity O(n) - The .split() method iterates through each element in the string, resulting in the O...

Container With Most Water

View Container With Most Water on LeetCode Statistics Time Spent Coding 12 minutes Time Complexity O(n) - We only iterate through each element once, resulting in the O(n) time complexity. Space...

Valid Palindrome

View Valid Palindrome on LeetCode Statistics Time Spent Coding 20 minutes Time Complexity O(n) - Each element in the string (n) is visited only once, resulting in the O(n) time complexity. Spac...

Longest Consecutive Sequence

View Longest Consecutive Sequence on LeetCode Statistics Time Complexity O(n) - Each element is visited at most three times, resulting in the O(n) time complexity. Although the time complexity sh...

Sqrt(x)

View Sqrt(x) on LeetCode Statistics Time Spent Coding 5 minutes Time Complexity O(n) - In the worst case, we must loop ≈ x//2 times through the while loop, but big O complexity represents the gr...

Valid Sudoku

View Valid Sudoku on LeetCode Statistics Time Spent Coding 30 minutes Time Complexity O(n * m) - We must check each cell, meaning we must iterate through each row (n) and each column (m), result...