Home
Leet Code Learning Logs
Cancel

Length of Longest Fibonacci Subsequence

View Length of Longest Fibonacci Subsequence on LeetCode Statistics Time Spent Coding 30 minutes Time Complexity O(n2log m) - The n2 comes from the nested for loop, where n is the length of arr,...

Largest Rectangle in Histogram

View Largest Rectangle in Histogram on LeetCode Statistics Time Complexity O(n) - While the algorithm may iterate over the stack inside of the for loop, this is not common, and it will only happe...

Binary Search

View Binary Search on LeetCode Statistics Time Spent Coding 1 minute Time Complexity O(log n) - The binary search algorithm takes at most O(log n) time. Space Complexity O(1) - The number of va...

Integer Replacement

View Integer Replacement on LeetCode Statistics Time Spent Coding 16 minutes Time Complexity O(log(n)) - For the majority of iterations, n is divided in half, resulting in the O(log(n)) time com...

Add Two Numbers

View Add Two Numbers on LeetCode Statistics Time Spent Coding 5 minutes Time Complexity O(n+m+k) - We must iterate through each digit of the number in l1 (n) the number in l2 (m) and the sum of ...

Decode String

View Decode String on LeetCode Statistics Time Complexity O(?) - The time complexity strictly depends on the number of encoded strings and the number of times they are repeated, making it impossi...

Generate Parentheses

View Generate Parentheses on LeetCode Statistics Time Complexity O(2n) - The algorithm must explore each possible combination of strings of length 2n, resulting in 22n time, but big-O ignores con...

Trapping Rain Water

View Trapping Rain Water on LeetCode Statistics Time Complexity O(n) - The program iterates through each element in the input list, resulting in the O(n) time complexity. Space Complexity O(1) -...

Time Based Key-Value Store

View Time Based Key-Value Store on LeetCode Statistics Time Complexity O(log n) - Initializing and setting a value takes O(1) time, but the get method takes O(log n) because we are performing a b...

Multiply Strings

View Multiply Strings on LeetCode Statistics Time Spent Coding 1 minute Time Complexity O(n+m) - We must iterate through all the characters from both input strings, resulting in the O(n + m) tim...