Skip to main content
Filter by
Sorted by
Tagged with
Advice
0 votes
1 replies
35 views

I'm into a little weird task in a project I'm making, the project is about a family and one section shows the family tree. this family tree is drawn by hand previously and it lacks too many family ...
Sarout's user avatar
  • 900
-2 votes
1 answer
66 views

I am trying to calculate the sum of mirrored elements in an array using Java. A mirrored element pair is formed by pairing the first element with the last, second element with the second last, and so ...
SHOBANA G's user avatar
-1 votes
0 answers
69 views

I am trying to analyze and optimize recursive algorithms, particularly with regards to their time and space complexity. I have written a recursive solution for the Fibonacci sequence and a merge sort ...
Harsh Goyal's user avatar
0 votes
0 answers
46 views

I have a game with a frame counter which increments at a fixed rate, and my goal is for two instances of the game on different computers to sync this number so that they will have the same number at ...
Henry C's user avatar
  • 59
-3 votes
0 answers
58 views

Suppose we have an 𝑚*𝑛 grid, let 𝑖=0,...,𝑚−1 and 𝑗=0,...,𝑛−1. For each grid point we have an array 𝑆𝑖𝑗 of size 𝑁 that serves as local score function. We want to to find a way that assigns ...
Peter Wu's user avatar
  • 279
Advice
0 votes
2 replies
60 views

I have a problem where I need to cut off text based on a max length. But the inputted string could be html a la <p>hello</p>. the html tags do not count towards the max length. for example ...
Jacob Pecile's user avatar
4 votes
1 answer
151 views

I've been working on implementing some compression algorithms in C/C++ and JavaScript, I've started by building out LZSS. So far everything seems good. I check my dictionary buffer for matches, and if ...
Mornig Star's user avatar
Advice
1 vote
8 replies
132 views

Found this code exercise on W3R. Been trying to figure out the relationship between the outer and inner loop (i and j), but can't seem to wrap my head around it. If anyone could walk me through this ...
Stanislav Matveyevich's user avatar
-4 votes
0 answers
140 views

Imagine you get sequence of integers: [a1 a2 a3 ... an] where: 1 <= a <= 10^6 1 <= n <= 10^6 You are given a function f(x) that can change a number to the closest lower prime number, or ...
ToridFartFart's user avatar
2 votes
1 answer
117 views

I’m trying to solve the following Leetcode problem: You are given a 2D integer array intervals where intervals[i] = > [starti, endi] represents all the integers from starti to endi inclusively. A ...
Utkarsh Mishra's user avatar
0 votes
1 answer
207 views

I'm interesting in possible implementation approaches for a quite special variant of a list, with the following requirements: Efficient inverse lookup ("index of"): "give me an index ...
cubuspl42's user avatar
  • 8,601
Advice
1 vote
3 replies
76 views

I want to implement in python some algorithms from a paper that allow for a pre-trained neural network to be modified (adding or removing neurons or layers) conserving (theoretically) the outputs of ...
Rubén Sales Castellar's user avatar
6 votes
2 answers
301 views

I'm working on a problem where I need to count, for each possible common difference D, the number of contiguous subarrays whose elements can be rearranged to form an arithmetic progression with common ...
YAR's user avatar
  • 63
0 votes
0 answers
74 views

In the code block below is my current Negamax implementation, it is currently barebones. My question is why do Blocks 1 & 2 have to occur for a node that is expected to incur a beta-cutoff (i.e. ...
VHDLover's user avatar
0 votes
2 answers
76 views

I've been trying to teach myself various sort methods just for the sake of being able to use them in the future and right now I've been teaching myself about shell sorts. I understand the way shell ...
Neptunium-Eater's user avatar
0 votes
0 answers
60 views

I am working on a program that is supposed to build a tree using nested lists in Racket. I believe I am very close, but I am stuck on one section of my insertion testing process. The syntax for my ...
JoshLeonthe1st's user avatar
Advice
0 votes
3 replies
70 views

The context is implementing conversion functions between Gregorian calendar dates and Julian dates. Most (nearly all?) such implementations have restrictions on the dates - typically requiring that ...
John's user avatar
  • 1,673
0 votes
2 answers
108 views

I am trying to understand Wallace Trees. The algorithm goes multiply each bit of one number a by each bit of the other (b), which is accomplished as a simple AND gate, where the partial product of ...
yosmo78's user avatar
  • 641
2 votes
1 answer
201 views

The inverse of the gamma function over the reals is multivalued with an infinite number of branches. This self-answered question is about the principal inverse of the gamma function, Γ0-1(x), whose ...
njuffa's user avatar
  • 27.1k
-3 votes
1 answer
171 views

The algorithm I've written for an assignment is closely related to this monotonic stack approach https://www.geeksforgeeks.org/dsa/next-greater-element/ Best case: n pushes → Time complexity: O(n) ...
user29898's user avatar
2 votes
1 answer
160 views

Problem: We are given a list of integers of length n. What is the minimum number of elements whose sign you need to flip such that every prefix sum is non-negative? (A prefix sum is the sum of the ...
Marc Carlsan's user avatar
2 votes
1 answer
144 views

I am trying to implement Quick Sort in GNU COBOL (version 3.2.2) using a recursive subprogram. The sorting logic is standard and works perfectly in other languages (C, Python), but when I run it in ...
TranTrung's user avatar
1 vote
1 answer
319 views

I'm trying to implement the Cooper–Harvey–Kennedy algorithm from this paper in C++. The original is used to find dominators, however in my case I need to find the postdominators. For this, I am aware ...
DeepQuantum's user avatar
9 votes
2 answers
382 views

Consider an array of a permutation P of length n (n > 2), namely some order of the integers 1 through n. Example of P with length n = 7, [6,5,2,3,7,1,4] A "score" of a permutation is ...
user31824378's user avatar
-2 votes
1 answer
181 views

I’m trying to implement an in-place Quick Sort in Python. I have two slightly different versions of my partitioning logic, and I’m confused because both seem correct on small arrays, but the second ...
Lisguen's user avatar
  • 11
6 votes
3 answers
398 views

I've got a list P of 2-dimensional points, 100 ≤ |P| ≤ 100000, and a list C of circle centers, 100 ≤ |C| ≤ 100000. All coordinates (x,y) ∈ P or (x,y) ∈ C are integral, 0 ≤ x,y ≤ 4095. P and C may ...
hidefromkgb's user avatar
  • 6,002
2 votes
1 answer
136 views

I am tasked with a question as follows: We have n players and we want to hold a wrestling tournament with exactly n * (n - 1) / 2 matches. In each day a player can only play at most one match. However,...
Eastern Skill's user avatar
-2 votes
1 answer
96 views

I have a Set of 2D points that I want to create a set of areas from, similar to a Voronoi Diagram. The difference is that I would like these areas to be blended, like in the following image. I wouldn'...
CptHavvock's user avatar
2 votes
1 answer
122 views

I need a really fast vectorized maximal independent set algorithm implemented in pytorch, so I can use it for tasks with thousands of nodes in reasonable time. I cannot use networkx, it is way too ...
Kemsikov's user avatar
  • 640
-2 votes
1 answer
119 views

I’m developing a Qur’an search application that allows users to search for Arabic words and find their occurrences across the Qur’an. To improve accuracy, I added a feature that removes Arabic ...
Salma Ahmed's user avatar
3 votes
3 answers
190 views

The problem: Given an array in which the number of negative elements is equal to the number of positive elements (arranged in arbitrary order). Swap the first negative and the first positive, then ...
user567_9's user avatar
2 votes
2 answers
142 views

Wikipedia and other textbooks reference binary selection sort's asymptotic worst-case time complexity to be O(n^2), usually justifying this with any extra computation caused by swaps. I don't ...
PostalCat's user avatar
7 votes
3 answers
249 views

I have an array x of n >= 4 elements, at indices 0..n-1. I want to swap the elements at indices j and k, where 0 <= k < j < n with the elements at indices 0 and 1 (it doesn't matter ...
The Lost Petrol's user avatar
-3 votes
1 answer
98 views

Analysis of Google Fonts Here is me scrolling through the Greek fonts As you scroll, you'll see it progressively calls the css2 url like: https://fonts.googleapis.com/css2?family=STIX%20Two%20Text%...
Lance Pollard's user avatar
2 votes
1 answer
126 views

I have a room that is a box. There is a single rectangular window on one of the walls of the room. A directional light source is shining into the room through the window. The light source has a ...
nj16's user avatar
  • 133
-3 votes
1 answer
154 views

Please be merciful - I've never asked a question here (I've answered a few) and am a total Python noob. I developed an algorithm in SQL Server to compute the Longest Possible Common Subsequence (LPCS) ...
Alan Burstein's user avatar
5 votes
3 answers
223 views

I implemented a recursive solution in Python to check if two binary trees are identical, which traverses nodes recursively and compares values and structure. The time complexity is O(n), space O(h). ...
Jared McCarthy's user avatar
8 votes
1 answer
238 views

Parallel policy states that order of iterator evaluation is not guaranteed. However, std::find*, std::search and std::mismatch all say that they return first iterator matching condition. How do those ...
Dominik Kaszewski's user avatar
3 votes
2 answers
520 views

Given StartTime and endTime for N employees, an employee can form a team if his working hour overlaps with other employees' (both startTime and endTime inclusive). Find the maximum team size. Example: ...
QA Android Alfa's user avatar
4 votes
1 answer
309 views

I was reading the paper Beam-Stack Search: Integrating Backtracking with Beam Search by Rong Zhou and Eric A. Hansen and I was attempting to implement it in Java (see PathFinding.java repository in ...
coderodde's user avatar
  • 967
0 votes
0 answers
95 views

I have a bunch of data which is indexed by key/value pairs. For example I might have x=1, y=2, z=3 => data="1,2,3" and x=1,y=2 => data="1,2" etc. The operations I need to ...
Mumrah's user avatar
  • 422
0 votes
0 answers
72 views

Recently, I developed a MATLAB-based simulation to evaluate my robot pathfinding algorithm. The robots operate on a network of unidirectional tracks, where each robot computes a single path from its ...
CangWangu's user avatar
  • 181
7 votes
3 answers
299 views

The problem is to find the longest sequence of numbers from 1 to 100 such that each number is either multiple or divisor or the previous, and with no repetition. For example, 50 25 5 35 7 63 21 is a ...
Zorm's user avatar
  • 71
1 vote
3 answers
109 views

I’m writing a chess engine in C++ that communicates via the UCI protocol, and I need an efficient way to check whether the allocated search time has been exceeded without adding too much overhead. The ...
Viliam Holly's user avatar
1 vote
1 answer
110 views

The current problem I'm having is that when the code runs it shows me "None" in the terminal. /usr/local/bin/python3.12/Users/jaredmccarthy/Desktop/2025/ejercicios_leetcode.py None Process ...
Jared McCarthy's user avatar
1 vote
1 answer
81 views

Given the root of a binary tree, return the level order traversal of its nodes' values. (i.e., from left to right, level by level). What's the problem with the following implementation? How to fix it?...
peter8015's user avatar
2 votes
0 answers
115 views

I'm researching about maintaining order in a list like JIRA, and I come across Jira Lexorank. I've already understood it's core concept, but there are 2 questions that I struggle to find the in depth ...
nanh's user avatar
  • 51
5 votes
2 answers
253 views

Okay, here's the problem I have. I'd like to do something like this: V(n,k) generates all n-sized permutations in which each permutations contains all digits from 0 to k-1 in lexicographic order. V(2,...
Reptorian's user avatar
-2 votes
2 answers
150 views

I have an application where I have a Rule object that has a list of Filter predicates. I will be comparing many Events to the predicates, and want to know if they all match. Most Events will not match ...
Andrew Rueckert's user avatar
7 votes
2 answers
1k views

I'm trying to solve the following problem: Minimal Grid Path (CSES). Here is the content of the problem: You are given an n x n grid whose each square contains a letter. You should move from the ...
crxyz's user avatar
  • 1,138

1
2 3 4 5
2430