Skip to main content

All Questions

4 votes
1 answer
117 views

Calculate optimal game upgrades, v2

This is the second iteration of the code I originally posted here: Calculate optimal game upgrades. Based on the feedback there, I chose to change the code to use a dynamic programming approach with ...
ayaan098's user avatar
3 votes
2 answers
362 views

Divide a set into subset with some constraints

Problem: Given a list L consisting of not necessarily unique non-negative integers, find the minimum number of subset with maximum sum ...
xrfxlp's user avatar
  • 191
7 votes
1 answer
1k views

Printing the number of ways a message can be decoded

My below solution to the following problem is exceeding the maximum recursion depth. I am looking for any improvements which i can make. Problem Alice and Bob need to send secret messages to each ...
Sai Dutt's user avatar
  • 121
5 votes
1 answer
351 views

Total number of non overlapping subsets

I am trying to solve this question. The essence of the problem is this: Given a list of school classes with start and end times, find the total number of non-overlapping subsets. I've written up a ...
nz_21's user avatar
  • 1,051
4 votes
1 answer
633 views

The Dungeon game

This is a Leetcode problem - The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out in a 2D grid. Our ...
Justin's user avatar
  • 2,575
2 votes
0 answers
377 views

Bursting Balloons

This is a Leetcode problem - Given n balloons, indexed from 0 to n-1. Each balloon is ...
Justin's user avatar
  • 2,575
-1 votes
1 answer
908 views

Python program to solve the "rod-cutting problem"

An assignment at school required me to write a program for this task: In the rod-cutting problem, we are given a rod of length n inches and a table of prices <...
Justin's user avatar
  • 2,575
3 votes
1 answer
2k views

Python program for "0-1 knapsack problem"

Here is what a knapsack/rucksack problem means (taken from Wikipedia): Given a set of items, each with a weight and a value, determine the number of each item to include in a collection so that ...
Justin's user avatar
  • 2,575
4 votes
2 answers
821 views

Find the longest rectilinear path in a matrix with descending entries

Problem (Skiing): Each number represents the elevation of that area of the mountain. From each area (i.e. box) in the grid, you can go north, south, east, west - but only if the elevation ...
RoyaumeIX's user avatar
  • 157