python (65.1k questions)
javascript (44.2k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (12.9k questions)
What is the space complexity of a function that creates a variable of value `N!` (N factorial)?
The bit-length an integer of value N is O(lgN).
What is the bit-length of an integer of value N! (i.e. N factorial)? If a function gets passed in a list of length N and it creates a variable of value ...
joseville
Votes: 0
Answers: 1
What technique should I think about when I have to transform an algorithm from O(n) to O(1) space complexity?
For example for the Build Array from Permutation (LeetCode question).
I was thinking about temporary variable to transform this brut fore algorithm from O(n) to O(1)space complexity algorithm. (soluti...
Nissa Saba
Votes: 0
Answers: 1
Python function time complexity
I am wondering if I calculate the time complexity correctly with the function below.
mat is a list of lists.
k is an integer.
def kWeakestRows(mat, k):
hashmap = {}
for i in range(len(mat)):
...
Dominic
Votes: 0
Answers: 1
Space complexity of word break algorithm
One approach to solve https://leetcode.com/problems/word-break/ is to use an array for memoization.
The solution claims that it will have a space complexity of O(N).
However, I think it should be clos...
csguy
Votes: 0
Answers: 1