Skip to main content

All Questions

Tagged with
0 votes
2 answers
363 views

fastest way to find number of smaller elements to the right of an array

In Daily Coding Problem, Miller&Wu have the following problem : Given an array of integers, return a new array where each element in the new array is number of smaller elements to the right of ...
molyss's user avatar
  • 181
5 votes
4 answers
641 views

Processing a 2D matrix - need to speed up my O(n^4) algorithm

I have an n x n matrix which I need to convert into a list sorted by value. Starting with the maximum value cell at (row x1, col y1), I must immediately exclude all cells where (x >= x1, y <= y1)...
Irfan434's user avatar
  • 187
4 votes
4 answers
2k views

Ahead-of-time compilation to native machine code of dynamically typed languages

It is my understanding that: It's particularly difficult to compile ahead of time, to efficient native machine code, a dynamically typed language like Python. Largely as a result of the above, the ...
Amelio Vazquez-Reina's user avatar
-1 votes
1 answer
135 views

time complexity for 3 foor loops different leangth [duplicate]

I have this method arr // input new_ seq = [] for i in arr: new_seq.append(i) __new_seq = [x for i, x in enumerate(arr) if x not in new_seq] for j in __new_seq: new_seq.append(j) ...
Farah Amawi's user avatar
0 votes
1 answer
3k views

Comparing Two JSON Files In O(n)

I've got a scenario where I need to compare two JSON files and override one if the values are different. These JSONs also include arrays (i.e. [) My approach is to traverse one JSON to dictionary O(n)...
Simply_me's user avatar
  • 145
0 votes
1 answer
90 views

python snippet optimization explanation

I'm attempting optimize and figure out why for input n a function I wrote f(n) appears to never finish executing when n > 26. TL;DR I need to figure out how to find the complexity of various python ...
grepNstepN's user avatar
3 votes
1 answer
16k views

How costly are the Python dict and set in-built types?

I have undertaken a project concerning database deduplication. I did some research and have found that the Python dict type actually is a hashmap that uses open addressing. In the deduplication ...
yati sagade's user avatar
  • 2,089
0 votes
1 answer
224 views

Whole Solution Complexity ... vs Development Complexity

I am generally a PHP Developer that deals in a few different MVC frameworks. I am being tempted (like most) to break out of my comfortable LAMP environment in pursuit of a "prettier" and "more simple"...
jondavidjohn's user avatar