Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
0 answers
21 views

Latex formulas common parts detector

I have a task to make an anti-plagiarism of formulas. It is necessary for it to highlight similar places in two formulas (example in the photo). But there is a problem, after I found these similar ...
Дмитрий Дашкин's user avatar
3 votes
9 answers
114 views

Finding the last unique string in a list

I was doing some coding on CodeSignal to refresh my knowledge. I was asked this question: Suppose you've got a list of words, let's say ['apple', 'banana', 'apple', 'mango', 'banana']. Each word ...
mans's user avatar
  • 18k
0 votes
1 answer
29 views

What constant time function applied to search for a set in all sets using a smaller set? Can bloom filters be compared with eachother?

I have messages that are grouped into separate sets - they are unordered String keywords. I want to search for patterns in the messages by matching sets to other sets. This is set intersection but I ...
Samuel Squire's user avatar
0 votes
0 answers
27 views

How do I format the data in an Excel spreadsheet?

There is a file with an **Excel ** spreadsheet containing the following type of data: россия, московская область, ленинский район, г.видное, ул.заводская, д.6, кв.22 643,163000,78,,санктпетербург г,,...
dynamic.aerospace.inc's user avatar
-1 votes
0 answers
33 views

python grid click algorythm [closed]

This is my code I wrote so far. But I am stuck at hardest part. code: import time #import for sleep function from pynput.mouse import Button, Controller #import of pynput functions from pynput....
user28704017's user avatar
-4 votes
0 answers
60 views

Crypto bot strategy [closed]

I’m working on a cryptocurrency trading bot that integrates with the Valr API, focusing on the ETHZAR (Ethereum to South African Rand) pair. The bot uses WebSockets to receive real-time market data ...
Cameron A's user avatar
2 votes
1 answer
67 views

networkx finding shortest path in edge label order

I work for an airport, and my task is to calculate the taxiing routes for airplanes on taxiways, ensuring they follow the prescribed road sequence. Here, I'll give an example and would like to ask if ...
Rabbids's user avatar
  • 176
3 votes
2 answers
86 views

Efficient algorithm that returns a list of unique lists given a list of of lists as input

Given a python list of lists containing numbers i.e lists = [ [1, 2], [2, 1], [3, 4] ], the problem is to return a list of all unique lists from the input list. A list is considered a duplicate if it ...
ariko stephen's user avatar
0 votes
0 answers
35 views

Extracting Hurst index from fBM using rescaled range (R/S)

I implemented in Python the rescaled range algorithm to compute the Hurst exponent as follows: import numpy as np def hurst(data): ...
Joe's user avatar
  • 123
0 votes
1 answer
37 views

how can i use multiprocessing for web scraping in selenium python by calling one function in different driver duo to override issue

I have a sequence to do in web scraping but it took lot of time so instead of calling the single function one by one I want to pass it as different processes and if I do so I have to face conflict of ...
Deep's user avatar
  • 1
0 votes
0 answers
40 views

How to implement Crow Search Algorithm and kmeans

I've been trying to implement my base paper which is about community detection using deep learning for more than a year. In this paper Crow Search Algorithm and kmeans have been used but I can't ...
Mahsa.S's user avatar
-4 votes
1 answer
59 views

Left and Right Contest Question TLE Kattis

I am trying to solve the Kattis problem Left and Right: Problem D Left and Right With modern technology advancement, it is now possible to deliver mail with a robot! There is a neighborhood on a ...
SV Prime's user avatar
0 votes
0 answers
37 views

Generation of paths on a sphere in Blender

There is a code (which I will provide below) generated using ChatGPT. This code generates a sphere (an icosphere with a high subdivision count, though you can use a sphere with a higher subdivision ...
Elijah Prisyazhnyuk's user avatar
1 vote
1 answer
129 views

How to recursively calculate all paths to a terminal state in an iterated system with two state variables? [closed]

Compute the number of ways to reach the terminal state (A = 1) using recursion. Consider an iterated system with two state variables A and B. A can have a values of 0 or 1 B can have a value of 0,1,...
Anny Fernando's user avatar
1 vote
0 answers
77 views

Branch and bound algorithm

I'm trying to implement branch and bounds algorithm in order to find optimal solution for transportation problem with truck loading limitations. In other words, I have 6 ton trucks and I use them for ...
Pavel Jefimovich's user avatar
0 votes
1 answer
38 views

I want to resend the remaining networks from Ford Fulkerson,

With this code below I will get the result Total flow through all doors after first run: 110 Total flow is 110. Remaining flow to send: 10 But the total flow I need to send is 120. So I want to send ...
StAndrews's user avatar
1 vote
0 answers
119 views

Zuma inspired game heuristic and successors [closed]

I have a university assignment to design an admissible heuristic and reduce the number of successors for a game inspired by Zuma. The game features a line of colored balls (colors: 1, 2, 3, 4) and ...
Ziv Elbaz's user avatar
0 votes
1 answer
41 views

Is there a way to do an Excel INDEX/MATCH within Python using two dataframes as inputs

Have googled and only relevant answers prescribe a merge which isn't applicable in my case. I have two data frames: da 2023-08-14 06:30:01 B C D E F G 2023-08-14 06:30:01 B C D E F ...
Chris's user avatar
  • 1,646
2 votes
4 answers
139 views

How to efficiently solve the Maximum Product Subarray problem in Python?

I’m trying to solve the Maximum Product Subarray problem, which is described as follows: Given an array of integers (positive, negative, or zero), find the maximum product of any contiguous subarray. ...
Rishal kumar's user avatar
-3 votes
2 answers
35 views

How to efficiently find common elements between two large lists in Python while maintaining order? [duplicate]

I am working with two large lists of integers in Python, and I need to find the common elements between them. The result should preserve the order of the elements as they appear in the first list and ...
Siva revanth Kodavali's user avatar
0 votes
2 answers
71 views

How to efficiently perform dynamic programming with complex state dependencies in Python?

I am working on a Python project that involves implementing a dynamic programming (DP) algorithm, but the state dependencies are not straightforward. Here's a simplified version of my problem: I need ...
Plamen Nikolov's user avatar
4 votes
2 answers
109 views

How to Mark Repeated Entries as True Starting from the Second Occurrence Using NumPy?

Problem I have a NumPy array and need to identify repeated elements, marking the second occurrence and beyond as True, while keeping the first occurrence as False. For example, given the following ...
Dos_Santos's user avatar
0 votes
1 answer
64 views

When writing quicksort in python, is it possible to simultaneously have a method signature of quicksort(arr) -> void, and have quicksort be recursive?

I have written an assignment for a data structures class and am having trouble figuring out how to "Implement the main quicksort function that recursively sorts the subarrays formed by ...
Gabriel Denney-Martell's user avatar
0 votes
1 answer
82 views

How to optimize this code: Leetcode input was unexpectedly ( Memory Limit Exceeded )

Leetcode question: Given a binary array nums, return the maximum length of a contiguous subarray with an equal number of 0 and 1. Leetcode entered a very long input of to the function and its IDE ...
TheWalrus's user avatar
-1 votes
3 answers
97 views

How can I efficiently find if an array contains duplicates within a specific distance using Python? [closed]

I'm working on a Python problem where I need to check if an unsorted array contains any duplicates within a specified distance k. Specifically, I need to return True if any value appears more than ...
Pranav's user avatar
  • 1
0 votes
1 answer
96 views

Determining a combination of selections from a list of sets that would yield the maximum number of unique numbers

Determining a combination of selections from a list of sets that would yield the maximum number of unique numbers Consider an array of sets, with each set containing an arbitrary number of integers. A ...
C Ho's user avatar
  • 1
1 vote
1 answer
48 views

Why does this implementation of the Block Tridiagonal Thomas algorithm give such large errors?

See below my attempt at implementing the block tridiagonal thomas algorithm. If you run this however, you get a relatively large (10^-2) error in the block TMDA compared to the np direct solve (10^-15)...
Tom Waits's user avatar
  • 135
1 vote
1 answer
129 views

Python decryption function not producing expected output [closed]

I'm implementing a password decryption function in Python, but I'm having trouble getting the expected output. The function is supposed to apply alternating rotation values to characters based on ...
miali2's user avatar
  • 11
5 votes
1 answer
103 views

Efficient way to delete columns and rows from a numpy array using slicing and not np.delete

Would it be possible given an array A, bad row indices and bad column indices to use slicing to make a new array that does not have these rows or columns? This can be done with np.delete as follows: ...
KyroHere's user avatar
  • 107
3 votes
0 answers
81 views

Getting the 2D projection from a 3D mesh in python

I am currently trying to get all of the 2d projection of a 3d mesh model of a cat on each face of it 3d bounding box using Python. You can download the 3d mesh model of a cat here: Cat model This is ...
Laika's user avatar
  • 31
4 votes
1 answer
69 views

Optimize flow in a graph with multiple sources and sinks without capacity constraints on edges

I’m working on a flow optimization problem within a graph that represents an energy network. Here are the specifics: Graph Structure: I have an undirected graph representing a network of streets or ...
Eric Contreras's user avatar
1 vote
1 answer
68 views

Fastest way to divide a 2D array in python into counterclockwise patches

Given a 2D array of size (W,H), for example (3,4). You can think of each point in that 2D array as a corner of a rectangular patch. I want to divide that array up into its individual patches as shown ...
KyroHere's user avatar
  • 107
0 votes
0 answers
40 views

When implementing Algorithm X, how do I iterate until all possible solutions are created and shown?

I'm trying to use Algorithm X to solve the exact cover problem of a given matrix. Details of Algorithm X I'm meant to implement: First we find a column c with the fewest 1s, pick row r that contains ...
rhombino's user avatar
8 votes
7 answers
538 views

How to determine if a large integer is a power of 3 in Python?

I'm trying to determine if a given positive integer ( N ) is a power of 3, i.e., if there exists a nonnegative integer ( x ) such that ( 3^x = N ). The challenge is that ( N ) can be extremely large, ...
Adel's user avatar
  • 199
1 vote
2 answers
173 views

How can I enhance the time complexity of arranging bricks into stacks based on specific conditions?

I’m working on a problem where I need to arrange N bricks of varying lengths into the least number of stacks. The rules for stacking bricks are that a brick 𝑖 can be placed on top of brick 𝑗 only if ...
Adel's user avatar
  • 199
3 votes
3 answers
124 views

How to efficiently remove overlapping circles from the dataset

I have a dataset of about 20,000 records that represent global cities of population > 20,000. I have estimated radius which more or less describes the size of the city. It's not exactly accurate ...
Sebastian Meckovski's user avatar
4 votes
1 answer
54 views

Fastest way to combine image patches given as 4D array in python

Given a 4D array of size (N,W,H,3), where N is the number of patches, W,H are the width and height of an image patch and 3 is the number of color channels. Assume that these patches were generated by ...
KyroHere's user avatar
  • 107
1 vote
0 answers
22 views

How can I detect if two peaks are at the same horizontal level with a threshold that works across different intervals in an OHLCV dataset in Python?

I am working with an OHLCV (Open, High, Low, Close, Volume) dataset and need to detect whether two peaks are at the same horizontal level within a certain threshold. Currently, I am using an angular ...
Dany Nuñez's user avatar
0 votes
0 answers
21 views

A problem with video target tracking for key point matching

There is a problem that can't be solved, that is, after obtaining the key points, the tracking based on the key points should be carried out in the subsequent videos. For example, I want to use xfeat ...
slimshady's user avatar
1 vote
1 answer
81 views

Algorithm for Assigning Values to Variables According to a List of Conditions

I'm hoping to create a python script that will take a list of arbitrary relationships between arbitrary variables and assign integers to them that match all comparisons given, or tell you where some ...
PotatoCode's user avatar
2 votes
3 answers
169 views

Sorting algorithm with "switch" and "rotate"

I'm dealing with a Python HW problem that's got me stumped. I need to sort a list of "marbles" (essentially a range that places each number into its own position) that can be in any order ...
AssimilateThis_'s user avatar
0 votes
0 answers
40 views

How to efficiently structure conversion logic between model pairs in Django?

I'm working on a Django app where I need to handle conversions between pairs of models with different units of measurement. These models are like tasks which the user needs to complete, and converting ...
Vellutante's user avatar
1 vote
1 answer
97 views

Trying to solve problem 19 on Euler Project

The question is: You are given the following information, but you may prefer to do some research for yourself. 1 Jan 1900 was a Monday. Thirty days has September, April, June and November. All the ...
alon ein eli's user avatar
-2 votes
1 answer
59 views

How can I optimize the finding of duplicates? [duplicate]

The code is down below. It finds duplicates in the generated array. How can it be optimized for faster work with big volume of data? There's some example of input and output data to imagine how it ...
  EF1M's user avatar
0 votes
2 answers
78 views

algorithm/logic for a unique matrix sorting problem

I have a matrix sorting problem where each row contains at least two numbers, with the rest of the columns being None. I need to sort this matrix such that: Each column is in increasing order, ...
ykerman's user avatar
  • 19
0 votes
0 answers
65 views

Implementaion of hmax for directed unfolding of Petri nets

Can somebody please help me try to understand if my implmentation and assumptions are right? Unfortunately, I do not have any means to reproduce it. I'm trying to implement a heuristic function hmax ...
Ariba Siddiqui's user avatar
0 votes
1 answer
82 views

Can't figure out a water-flowing algorithm

Context: I have a matrix of x and y dimensions. The left-most column and the top-most row are considered the edges of the North-West ocean. The right-most column and the bottom-most row are ...
Cristii's user avatar
  • 13
0 votes
0 answers
38 views

Genetic Algorithm Implementation – Error in Selection/Mutation/Population Formation Steps

I’m working on a genetic algorithm for an optimization task where I need to compare different parameters across three functions, including: Crossover: One-point (OT), two-point (DT) Mutation rates: 0....
blulow's user avatar
  • 41
1 vote
1 answer
98 views

Algorithms to fill in islands within lakes Python

I have an ndarray where each cell is either land (1) or water (0). In this ndarray, the background and border is all land (1), and there are lakes within. Some of these lakes have islands within them. ...
Chrom_X_Lucina's user avatar
2 votes
1 answer
86 views

What's a fast way to identify all overlapping sets?

I need to identify and consolidate all intersecting sets so that I ultimately have completely discrete sets that share no values between them. The sets currently exist as values in a dictionary, and ...
dewser_the_board's user avatar

1
2 3 4 5
275