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

All Questions

1 vote
1 answer
19 views

Maximizing sum of signed numbers by not skipping more than one consecutive value: DP goes wrong

I am trying to solve this code challenge: 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 ...
R M's user avatar
  • 11
3 votes
2 answers
105 views

A more efficient algorithm in finding the number of distinct decompositions a number has using only repdigits

This is a problem from a previous semester that I am trying to upsolve. I am trying to solve a problem involving the total number of ways of decomposing a number using only repdigits. A repdigit is a ...
Lesserrafim's user avatar
1 vote
1 answer
140 views

Asteroid Mining - Dynamic Programming problem

I was given the following assignment: There is n gram of mineral to be dug up on a certain asteroid. At the beginning there is only one robot at our disposal. Each robot can do one of two activities ...
PK96's user avatar
  • 51
0 votes
1 answer
51 views

Visiting dynamic website and clicking on arrows to expand and then select elements to load the page contents using Python

I am nope in python. I want python to visit this site https://icd.who.int/browse10/2019/en , and click on (arrows to expand them) which are located on this //tr[@class='ygtvrow']//td[starts-with(@id, '...
Mohammad Aladwani's user avatar
0 votes
0 answers
71 views

How to implement join order optimization using dynamic programming in Python?

I am working on a project to optimize SQL queries by determining the optimal join order using dynamic programming in Python. Context I am connecting to a PostgreSQL database and need to calculate the ...
user25210056's user avatar
3 votes
3 answers
159 views

Longest Repeating Subsequence: Edge Cases

Problem While solving the Longest Repeating Subsequence problem using bottom-up dynamic programming, I started running into an edge case whenever a letter was repeated an odd number of times. The goal ...
William Edwardson's user avatar
0 votes
1 answer
64 views

Finding the most optimal way for updating a dynamic-programming array

Imagine there are n people in a line, which every one of them has there unique value for themselves from 1 to n, we try to sort them like this: repeat swapped = false for i from 1 to n do: ...
FrOZEn_FurY's user avatar
2 votes
3 answers
207 views

Maximum Sum Without Skipping Two Contiguous Elements

The task is to find the maximum sum of a subsequence of integers from a given list. The subsequence must follow two conditions: It must be contiguous, meaning the selected elements are in consecutive ...
Vahaid Sk's user avatar
0 votes
2 answers
55 views

dynamic programming: (minimum days of not eating icecreams)

Minimum Days Not Eating Ice-cream Ram decides to eat ice-cream for N days. On each day the ice-cream shop can have chocolate flavour or mango flavour or both or none. The availability of ice-cream ...
Srinivasan A's user avatar
1 vote
1 answer
235 views

fusing inner lists within list function to return highest possible integer dynamic programming

new to programming and currently trying to challenge myself and learn dynamic programming. I have this question to implement a function that takes an array and outputs the 'highest cuteness' of the ...
romynichols's user avatar
1 vote
1 answer
95 views

How to count cul-de-sacs (aka dead-ends) in a maze using Python?

Problem Statement I am working on a maze-solving program where I need to count the number of cul-de-sacs, also known as dead-ends. The maze is represented in a way that allows identifying different ...
big_djas's user avatar
0 votes
0 answers
35 views

Efficiently store a dynamic CSV file in Python: dataframe or dictionary?

I have the following CSV file storing the composition of different groceries baskets: POME FRUITS, STONE FRUITS, FRUITS. As you can see below a basket can contain another basket (basket 'FRUITS' ...
user11798649's user avatar
1 vote
0 answers
100 views

Dice Roll Simulation (Permutation Approach)

This is a question on leetcode. I'm aware it's efficiently a dynamic programming question, but I wanted to try a different approach to really exercise my understanding of data structures and ...
Duck Dodgers's user avatar
0 votes
0 answers
21 views

Efficiently store a dynamic increasing dataset and make computation on it

I want to write a python program that will compute the price of different groceries baskets as their constituants change. I have a csv file with the constituents of each basket. PS: a basket can ...
user11798649's user avatar
3 votes
4 answers
141 views

How to find min cost for element selection from a sequence of adjacent pairs

Given an array of integers (with at least two elements), I need to choose at least one element of each adjacent pair of elements in the array in a way that costs me the least. Then, return the cost ...
NitaStack's user avatar

15 30 50 per page
1
2 3 4 5
55