Skip to main content

All Questions

Tagged with
1 vote
1 answer
77 views

Checking several strings against a n-depth list of lists and returning one if its values

The data structure I am working with is a list of lists that is created by parsing a file. The depth of the list can vary. The list can have n Strings before its child-value begins. My current example ...
Qohelet's user avatar
  • 151
3 votes
1 answer
216 views

generate combinations from list of numbers

generate all combinations from list of numbers,the combinations can be pair of two numbers example 1 : list of 2 numbers [1,2] [ [[1],[2]], [[1,2]] ] example 2 : ...
Gurmessa Lemma's user avatar
5 votes
2 answers
2k views

Get two closest numbers in a list using recursion in python

I'm trying to use recursion to find the closest numbers in a list. I made a program that runs correctly without any errors but I want to know if there's a better way to write my program while still ...
Yusuf Halim's user avatar
2 votes
1 answer
127 views

Coin partitions

I am looking to obtain the partitions of coins that sum to a target amount So I tried search online, but every single website loves to use this problem to show the benefits of dynamic programming. ...
N3buchadnezzar's user avatar
1 vote
1 answer
203 views

Constructing a dependency list recursively

I am trying to find if there is better way to do this recursion. I went through some examples of memoization but found myself struggling to implement that with my code. example data: db_data and ...
hpal007's user avatar
  • 111
3 votes
1 answer
231 views

Killing a Hydra - Overengineered

Background This question is inspired by the question: Killing a hydra, and my response therein. I will restate the problem at hand in full so that this question is fully self contained You can only ...
N3buchadnezzar's user avatar
3 votes
2 answers
2k views

Simple Python Recursive Web Scraper

I tried to make a simple recursive web scraper using Python. My idea was to grab all the links, titles and tag names. Website: https://lifebridgecapital.com/podcast/ Course of Action: Grab all the ...
Abbas's user avatar
  • 39
2 votes
1 answer
464 views

Recursive type checking for containers

This code checks the type, length and depth (highest number of nested containers) of the container as well as the type of its sub-containers and its elements. There are also two simple methods for ...
user avatar
6 votes
1 answer
149 views

Approximation search source reconstruction localization algorithm

Goal To determine the coordinates of some signal source in a 3D space, given the coordinates of four observers and the time at which each saw the signal, as well as the velocity of the signal. ...
10GeV's user avatar
  • 305
5 votes
1 answer
142 views

python3 function to merge dictionaries

I have a bunch of JSON records, each record with a varying degree of completeness. In other words, record A may contain keys not in record B, and vice-versa. To get a better understanding of the data ...
wiggitywacker's user avatar
2 votes
1 answer
265 views

What is the most optimal way to concat XML files as one large string/text file?

Python3 - Recursive XML Files to Large Text File I have a recursive function that looks through a directory (there are 6000+ files). For each XML file found - the ...
leopardxpreload's user avatar
3 votes
0 answers
292 views

Noughts and Crosses Terminal Game with AI

I created a game which can play tic-tac-toe with: 0 players (AI vs AI), 1 player (human vs AI) or 2 player (human vs human). Here is the AI function which wraps around my innermost function. This ...
RelativelyUnique's user avatar
5 votes
2 answers
145 views

Traveling salesman to find beer types from breweries

I am writing a modified travelling salesman problem recursively in Python 3.7. It has to find the best path around breweries to find the most beer types and not to exceed the ...
Sam's user avatar
  • 153
-4 votes
1 answer
2k views

Finding The Largest Digit in a Number using a Recursive Function in Python [closed]

I tried it using the code given below. ...
Aritra Pal's user avatar
-3 votes
1 answer
52 views

How to convert Recursive Approach to iterative one(Super Reduced String)? [closed]

The Question: Steve has a string of lowercase characters in range ascii[‘a’..’z’]. He wants to reduce the string to its shortest length by doing a series of operations. In each operation he selects a ...
Piyush Keshari's user avatar

15 30 50 per page
1
2 3 4 5