Skip to main content
0 votes
2 answers
49 views

Remake color mixing function to find color to mix with given color to get the given result color

My question looks very strange, but I'll try my best to explain it. I got this function def combine_hex_values(d): d_items = sorted(d) tot_weight = 2 red = int(sum([int(k[:2], 16) for k in ...
Kirill Krutelev's user avatar
-7 votes
0 answers
55 views

Why is my create_spend_chart output not matching the required format? [closed]

I’m trying to solve a project where I build a Category class and a create_spend_chart function to create a text-based spend chart. My Category class methods (deposit, withdraw, transfer) seem to work ...
Yoofi T's user avatar
3 votes
1 answer
78 views

How to create a layout that only has all even or all odd row size, and changes by only 2?

I have been iterating with both Claude 3.7 Sonnet, and ChatGPT 4o, for days and days, trying to get this to be exactly how I want it, but it keeps making mistakes in the algorithm, and on an on in ...
Lance Pollard's user avatar
-1 votes
0 answers
45 views

Deadlock Issue in Multithreaded Resource Allocation System with Dynamic Task Dependencies [closed]

I'm developing a multithreaded application in C++ that manages a resource allocation system for tasks with dynamic dependencies. Each task requires a subset of resources (e.g., CPU cores, memory ...
Charliewonders's user avatar
-2 votes
0 answers
76 views

Efficient way to win points in chocolate bowl game [closed]

I'm working on an optimization problem involving a turn-based chocolate-sharing game, and I need help optimizing my current brute-force solution. Problem Description: You and your friend take turns ...
CodeCrusader's user avatar
1 vote
1 answer
67 views

Efficient algorithm to create ordered union of lists with unknown true ordering

I have a bunch of lists I need to combine. Each of these lists has an ordering, and each ordering is consistent with the ordering of an original list. (By consistent, I mean that each list can be ...
rasputin's user avatar
  • 345
-1 votes
0 answers
36 views

Optimizing synchronized pathfinding for two mazes with shared instruction sequence and "reset" pits (A* or BFS) [closed]

I'm working on a problem that involves synchronized pathfinding through two mazes. Here's the setup: Two mazes of equal size (n × m). Two agents start at position (0,0) in their respective maze. They ...
Kevin's user avatar
  • 1
4 votes
1 answer
103 views

How to optimize subarray transformation for large inputs?

I have a problem where I need to select a contiguous subarray from a list of integers and add any integer z (positive or negative) to all elements in the subarray, such that the frequency of a target ...
CodeCrusader's user avatar
5 votes
1 answer
234 views

efficient check whether unsigned integer value belongs to either of two compile-time constant intervals

In various contexts I have faced the issue of determining whether a given unsigned integer value belongs to either one of two non-overlapping intervals, and not infrequently these checks introduce ...
njuffa's user avatar
  • 26.3k
1 vote
1 answer
60 views

Round-robin tournament algorithm with drop-outs?

I'm trying to code a round-robin algorithm for a match-making program. The requirements are as follows: If there are an even number of people, everyone must have a match every round (if there's an ...
Swiftheart's user avatar
0 votes
1 answer
28 views

Custom Implementation of cosine similarity metric in k-means algorithm [closed]

Is there any way in the existing k-means algorithm implementations to use as distance metric a cosine similarity instead of euclidian distance ?
Παναγιώτης Πανάγου's user avatar
-1 votes
1 answer
34 views

What is correct path tracking in Floyd-Warshall algorithm?

There are several descriptions of the Floyd-Warshall algorithm, including the one in Wikipedia where path tracking logic described like in the pseudo-code below (copy from Wikipedia https://en....
RomanGirin's user avatar
-5 votes
0 answers
92 views

Algorithm for counting non-isomorphic embeddings on a square lattice [closed]

I am looking for an algorithm (and its implementation, preferably in Python) to solve the problem of counting "non-isomorphic embeddings" of some object consisting of N points (vertices) in ...
reinjanke reinjanke's user avatar
0 votes
1 answer
50 views

Implementing Breadth First Search from CLRS in Java

At my wits end here. I'm following this psuedocode from CLRS and I don't know why my final for loop doesn't keep going to give me the distance from the given source node to all other vertices. I'm so ...
Jide Fadairo's user avatar
4 votes
3 answers
221 views

How to select element from two complex number lists to get minimum magnitude for their sum

I have two python lists(list1 and list2),each containing 51 complex numbers. At each index i, I can choose either list1[i] or list2[i]. I want to select one element per index(Total of 51 elements) ...
Manish Tr's user avatar

15 30 50 per page
1
2 3 4 5
8099
X