Home
Leet Code Learning Logs
Cancel

Length of Last Word

View Length of Last Word on LeetCode Statistics Time Spent Coding 1 minute Time Complexity O(n) - Each character in the string is visited once, resulting in the O(n) time complexity. Space Comp...

Best Time to Buy and Sell Stock

View Best Time to Buy and Sell Stock on LeetCode Statistics Time Spent Coding 15 minutes Time Complexity O(n) - Each element in prices is only visited once, resulting in the O(n) time complexity...

Roman to Integer

View Roman to Integer on LeetCode Statistics Time Spent Coding 7 minutes Time Complexity O(n) - We must visit each element in the input string at least once, resulting in the O(n) time complexit...

Palindrome Number

View Palindrome Number on LeetCode Statistics Time Spent Coding 1 minute Time Complexity O(n) - Each number in x is visited at most twice, resulting in the O(n) time complexity. Since the multi...

Ugly Number

View Ugly Number on LeetCode Statistics Time Complexity O(log n) - The maximum number of divisions is log base [2,3, or 5] of n, resulting in the O(log n) time complexity. Space Complexity O(1) ...

Add Digits

View Add Digits on LeetCode Statistics Time Spent Coding 3 minutes Time Complexity O(1) - The static number of operations performed is independent of n, resulting in the O(1) time complexity. S...

Merge Two Sorted Lists

View Merge Two Sorted Lists on LeetCode Statistics Time Complexity O(n + m) - In the worst-case scenario, we must iterate through both lists, each having n and m elements, resulting in the O(n + ...

Find Minimum in Rotated Sorted Array

View Find Minimum in Rotated Sorted Array on LeetCode Statistics Time Complexity O(log n) - We are performing a modified version of binary search, and when binary search is performed on a sorted ...

Koko Eating Bananas

View Koko Eating Bananas on LeetCode Statistics Time Complexity O(log (max(piles)) * n) - We perform binary search on the interval 1 to max(piles), and for each search, we perform an operation th...

Search a 2D Matrix

View Search a 2D Matrix on LeetCode Statistics Time Spent Coding 10 minutes Time Complexity O(log (m * n)) - We are performing binary search on a sorted matrix with m rows where each row contain...