Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [algorithm]

An algorithm is a sequence of well-defined steps that defines an abstract solution to a problem. Use this tag when your issue is related to algorithm design.

0 votes
0 answers
5 views

Facing issues with a DP algorithm implementation

A user maintains a list of negative and positive ratings for movies in a collection. The user wants to choose some subsequence of movies from the collection to bring such that the following conditions ...
R M's user avatar
  • 1
0 votes
0 answers
7 views

Traverse a graph with multiple stops from a starting point? [duplicate]

I have an undirected weighted graph I need to traverse from X node to a list of nodes. The list is unordered by default, meaning that the order of which nodes are traversed is not important. What's ...
hesoyam's user avatar
0 votes
0 answers
18 views

The model(DecisionTreeClassifier) gives wrong results

I'm taking a machine learning course with an assignment to implement a fit method for DecisionTreeClassifier. Here are the links for more information: https://stepik.org/lesson/333977/step/8?auth=...
Kibar Jafarguliyev's user avatar
-7 votes
1 answer
51 views

WiggleSort: giving wrong output? [closed]

I am trying to solve LeetCode problem 324. Wiggle Sort II: Given an integer array nums, reorder it such that nums[0] < nums[1] > nums[2] < nums[3].... You may assume the input array always ...
ttait1's user avatar
  • 1
1 vote
3 answers
85 views

Fast integer sqrt using Math.Sqrt

I'm trying to calculate the square root of integer values. It doesn't need to be very accurate, but it should be fast and deterministic across platforms. I'm using this for a RTS game with lockstep ...
Ollhak's user avatar
  • 93
0 votes
0 answers
45 views

How can I estimate the difference in performance of a HashMap lookup vs List iteration in Kotlin?

I am working on an application that needs to map pdf documents to corresponding json data files (see: Kotlin data structure for efficient lookup of nested data for more details). In trying to ...
pbuchheit's user avatar
  • 1,663
-1 votes
0 answers
42 views

What is the time complexity of list1==list2 operation in Python? [duplicate]

It was my understanding that a condition equating operation would always be O(1) as we are simply checking if LHS is same as RHS. But this scenario got me thinking. if list1 == list2: print("Hi&...
Gl1tch1e's user avatar
0 votes
1 answer
42 views

Kotlin data structure for efficient lookup of nested data

I am currently working on an application that needs to create a mapping between document pdfs and corresponding JSON data files. The files are coming from a third party so I have no control over their ...
pbuchheit's user avatar
  • 1,663
0 votes
2 answers
55 views

How is my algorithm for stock span problem incorrect?

The question : The stock span problem is a financial problem where we have a series of n daily price quotes for a stock and we need to calculate the span of stocks price for all n days. The span Si of ...
newLearner's user avatar
-1 votes
0 answers
22 views

What should I focus while learning DSA? [closed]

So basically I am learning DSA for the first time and I dont want to overlearn or learn things that aren't neccessary. Can anyone tell me what I should focus on? DSA learning I am learning quick union ...
AbdulRehman Rizwan's user avatar
-8 votes
0 answers
42 views

Did Everyone know about Netflix game downloading algorithm on IOS? [closed]

We try to build a Games centre App that allow user can download game from our app. but in IOS we can't download directly like Andiron so try the other way like following Netflix game downloading flow ...
Reaksmey soriya's user avatar
0 votes
1 answer
63 views

How to store row-position in a database?

I am looking to emulate a feature in Excel/Google Sheets where there is a table of data, but someone may move a row up or down. Here is an example of the interaction: My first thought as to how to ...
David542's user avatar
  • 109k
0 votes
2 answers
89 views

Finding if strings can be anagrams

I have String s1 and String s2. I want to check whether it is possible to make s1 an anagram of s2 by removing a single character zero or more times from s1, and removing a single character zero or ...
Sid's user avatar
  • 87
-1 votes
0 answers
15 views

Cloud sim/cloud analyst

LB Policy I have implemented more than 5 algorithms but only default 3 algo is showing up on the option.How to fix it?(Honey bee etc ) Also mention through code in constants.java How to fix this issue ...
SRIDEEP SARKAR's user avatar
0 votes
3 answers
112 views

Join texts and optimize formatting

I have text objects (text1, text2, etc) with formatting information (eg. [bold, italic]). Now I want to concat these texts and format them in HTML. For a simple case it would transform the following ...
Andreas Gohr's user avatar
  • 4,855

15 30 50 per page
1
2 3 4 5
8072