Skip to content
Advertisement

Tag: time-complexity

Can we say O(n + m) is equivalent to O(n), when m is constant or when n > m

I was solving one of the leetcode problems(Longest Palindrome), where I am traversing the whole string(s) to count the frequency of each character traversing the array(charFreq) to determine whether the frequency of character is odd and doing operations accordingly. 1. Implementing using array where, 1 <= s.length <= 2000 s consists of lowercase and/or uppercase English letters only. But, is

TapeEquilibrium, Solution Failing Two Edge Cases

Currently working on problems from codility for practice, and for some reason I’m unable to get more than 83% correctness overall, originally I solved it with 100% correctness but with N^2 time complexity (it needs to be N or lower) I’ve adjusted my code to be able to solve in O(N) but now my correctness has dropped to 77%, I’m

Analysis of run time complexity

I need some help below I have some code I created for an assignment. I am having a hard time figuring out the time complexity of this algorithm. I looked at it and believe the O-notation is 0(n) and …

Advertisement