All Questions
Tagged with dynamic-programming greedy
166
questions
0
votes
0
answers
11
views
DynamicProgramming Proble,
Problem Link :https://www.geeksforgeeks.org/problems/count-numbers-containing-43022/1
Problem Description : You are given a number n, Return the count of total numbers from 1 to n containing 4 as a ...
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 ...
0
votes
0
answers
16
views
How do i slice an array into m groups and minimize the sum of elements of largest slice? [duplicate]
I want to slice an array into m groups and minimize the sum of elements of largest slice while respecting to the order of elements in array.
For example:
elements: 13.85 22.15 11.84 7.85 12.15 11.09
m:...
0
votes
1
answer
47
views
Optimizing Product Allocation to Baskets
I am currently facing a challenge in devising an algorithm that optimally solves the following task:
We have a set of products, each associated with specific baskets they can be placed into. For ...
1
vote
1
answer
164
views
Minimum Time to Perform One Task of Each Category (with Different Release Times)
I've recently taken an OA in which you needed to write an algorithm for finding the earliest time at which you were able to complete one task from each category. Each task has a duration and a time at ...
0
votes
1
answer
120
views
How to select n columns from a matrix minimizing a given function [closed]
I must buy one of each product, but I can visit no more then n shops. Which n shops should I choose to spend the least amount of money? Products are not divisible, every shop have full inventory.
...
1
vote
0
answers
110
views
Length of Longest Increasing Subsequence with at most K deletions
The input is a list of integers and an integer k. The output has to be the length of the longest possible increasing subsequence of contiguous elements(neighbor elements, for example in '1 0 2' 1 and ...
0
votes
5
answers
339
views
Dynamic Fibonacci program
Not entirely sure if I implemented it correctly, but I tried to use memoization for this fib programme and it turns out to be slower than if I just ran it without,
does anyone know why this is ...
-1
votes
1
answer
95
views
Finding the Maximum and Minimum Number of Operations to Delete all Element in a Circular List
In a circular list of length n, where a1 is adjacent to a2, a2 is adjacent to a3, and an is adjacent to a1. Each operation can delete one number, after each deletion, if there exists adjacent equal ...
1
vote
1
answer
144
views
Find a subset of a set of vectors such that the difference between the maximum and minimum element of the sum of the subset is minimal
The length of each vector is equal to 3. The number of vectors is no more than 300 and sum of the sum of all vectors is no more than 500.
Example:
For set of vectors: [0, 0, 1], [2, 3, 4], [0, 5, 0], [...
1
vote
1
answer
1k
views
Replace Adjacent Elements of Circular Array to Make All Elements Equal - DSA INTERVIEW QUESTION
You are given a circular array A containing N integers. You can perform the following operation on this array any number of items:
• For each i, replace A[i] by A[i-1], A[i] or A[i+1] i.e. you can ...
4
votes
2
answers
370
views
Algorithm to recover a set given the sums of all its subsets
There is a set A of positive/negative integers. We are given N numbers which are the sum of all its subsets. The task is to find the set A itself. Following is an example.
Input: 0 -2 4 5 2 3 9 7
...
2
votes
1
answer
73
views
Efficient Algorithm for Amount allocation problem
I am wondering if there is an efficient way to solve the following question.
We have 2 groups of buckets, which is represented by number arrays. The number is the bucket size. The bucket size and the ...
0
votes
0
answers
140
views
Problem of the traveler in the desert, greedy and dynamic approach
A traveler in a desert wants to go from one oasis to another until a final destination without taking the risk of dying from thirst (i.e. lack of water). He know the position of all the oases from his ...
0
votes
0
answers
186
views
Efficient algorithm for job sequencing, but with variable times needed
Problem: Given N tasks with potentially non-unique deadlines d1,...,dN and time needed t1,...,tN to complete each one (in hours), output a schedule that maximizes the number of deadlines met. Only 1 ...