Skip to main content
Stack Overflow for Teams is now Stack Internal: See how we’re powering the human intelligence layer of enterprise AI. Read more >
Filter by
Sorted by
Tagged with
4 votes
2 answers
112 views

I keep almost solving this. I've got a data set of python dictionaries that contain both lists and dictionaries that also contain lists and dictionaries. I want to find all instances of a substring in ...
pileofrogs's user avatar
-3 votes
0 answers
85 views

public static boolean isWordSymmetric(String[] words, int start, int end){ if (words[start].toLowerCase().equals(words[end - start].toLowerCase())) { if (start == end){ ...
Bry's user avatar
  • 1
0 votes
0 answers
52 views

I'm making a parser combinator library that gets compiled into imperative code. I've figured out how to compile tail recursion, simple recursion, and cross referential recursion, but can't figure out ...
Bleb1k's user avatar
  • 17
3 votes
2 answers
155 views

I do understand I have mistakes in this code #include <stdio.h> #include <stdlib.h> #include <string.h> int diziyi_yazdır(int dizi[], int dizi_uzunluğu) { for (int i ...
Creedance's user avatar
-2 votes
1 answer
174 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
2 votes
1 answer
114 views

At the risk of asking a question with an obvious solution: if I have a function in J that takes two arguments and returns two arguments and I want to accumulate the answer's second argument and to use ...
Shmuel Greenberger's user avatar
3 votes
3 answers
85 views

I am working on LeetCode problem 22. Generate Parentheses using a recursive backtracking approach in Python. The function works, but I’m having trouble understanding the flow of recursion, ...
Caleb's user avatar
  • 31
1 vote
2 answers
149 views

My question is focused specifically on assembly (intel). In C for example, recursion can be done with a simple return command but in assembly I feel like there's a lot more things going on, especially ...
Danilo Jonić's user avatar
0 votes
1 answer
86 views

this is kind of a continuation of an improved version of an old question of mine so basically I have a recursive Angular form and I’m using to manage a folder hierarchy. Each folder has a radio button ...
binga58's user avatar
  • 89
1 vote
2 answers
146 views

Let's say our binary tree (bt) looks like this: Node* root = new Node(); root->left = new Node("B"); root->right = new Node(); root->right->right = new Node("A");...
Arun Saini's user avatar
-1 votes
2 answers
164 views

# Iterative factorial function to safely compute very large factorials without hitting Python's recursion limit. # Recursive functions have a maximum depth, usually 1000, and factorial(2000) would ...
user31537598's user avatar
2 votes
1 answer
104 views

I have a recursively defined function my_func that is jitted using jax.jit from the jax library. It is defined below: # Imports import jax import jax.numpy as jnp from functools import partial import ...
Ben's user avatar
  • 539
0 votes
1 answer
67 views

When using this algorithm: jq -s 'def deepmerge(a;b): reduce b[] as $item (a; reduce ($item | keys_unsorted[]) as $key (.; $item[$key] as $val | ($val | ...
staxas's user avatar
  • 149
0 votes
1 answer
34 views

I'm trying to render a tree structure using VLT, by indenting the rendering depending on the level it's on. I tried to use a recursive macro which passes on the $indentLevel variable (see code below). ...
Sebastiaan Voorderhake's user avatar
1 vote
2 answers
91 views

I am trying to convert an XML string into multi-dimensioned PHP array. The difficulties are that XML comes with attributes and has nested values. My code works at parent level data but I am not sure ...
user5705009's user avatar
0 votes
0 answers
157 views

Background I am on an ARM Cortex-A72. To access bit fields of my core's system registers I use a macro code generation mechanism. For the sake of simplicity, I replaced void operator=(const uint64_t v)...
salkin's user avatar
  • 177
5 votes
2 answers
198 views

Let me introduce first the problem. I will present a simplification of my QT6 project app (in C++) to not make it too difficult to read, as the original code has lots of unnecesary things for this ...
Alberto Moreno Castro's user avatar
14 votes
1 answer
360 views

Why does this code output garbage on GCC like there is a UB? auto data = std::vector{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; auto output = [data](this auto self, size_t i) { if (i >= 10) { ...
Sprite's user avatar
  • 4,149
1 vote
1 answer
99 views

I'm working on making a program to read a chart of accounts and turn it into a tree of Account objects, which I will be doing stuff with later. The chart of accounts in question has several levels of ...
In Hoc Signo's user avatar
0 votes
1 answer
104 views

I am attempting to build and populate a data structure consisting of multiple, but variable count, nested dictionaries in C#. I am currently using a recursive function to do so. The data stored in the ...
buca117's user avatar
  • 21
0 votes
0 answers
32 views

I have a table like this: total alert group_id hlevel full_path parent_id root_group_id 5100FFFF-60B6-D5CD-FCCD-A8A3E03F0000 1 BizA\DivA 5100FFFF-60B6-D5CD-BFBA-A8A3E03F0000 5100FFFF-60B6-D5CD-FCCD-...
gpkbz's user avatar
  • 1
0 votes
1 answer
122 views

Is there a simple way to return 0 with a lambda function using and and or operators? For example, consider this function to sum elements in an array: sum = lambda tab: tab == [] and 0 or tab[0] + sum(...
david's user avatar
  • 1,593
2 votes
1 answer
114 views

So basically I have this code of FFT implemented in Python for 2^m samples. def fft(x): N = len(x) if N == 1: return x even = fft(x[0::2]) odd = fft(x[1::2]) result = [0] *...
RudraSama's user avatar
4 votes
2 answers
76 views

I have an undirected graph which nodes are numbered from 0 to 5. Adjacencies are given with a vector of lists #((1 2) (0 3) (0) (1) (5) (4))), thus node 0 is connected to nodes 1 and 2, node 1 is ...
david's user avatar
  • 1,593
1 vote
2 answers
88 views

I'm using the following code to get all files of given extensions inside a folder with it's respective subfolders. string path = "C:\\FolderA\\FolderB\\FolderC\\FolderD"; List<string> ...
vmHernandes's user avatar
3 votes
1 answer
104 views

I am somewhat new to Prolog, having only practised for a few months so far. I am stumped on the following problem and nothing I googled seemed to help. I wrote the following code into a Prolog ...
Ashley Ben Story's user avatar
0 votes
2 answers
91 views

I have a number represented as a large binary string (length can be up to 1 million bits). The number is recursively split as follows: At each step, divide the number x into two parts: floor(x/2) and ...
md emon6767's user avatar
0 votes
0 answers
150 views

I’ve already solved 2-Sum and 3-Sum problems: 2 sum uses a HashMap to check if target - nums[i] exists in HashMap. 3 Sum sorts array and then uses 2 pointers. Yesterday, during Flipkart GRID Coding ...
user20127888's user avatar
2 votes
1 answer
265 views

I'm working on a Hex game AI that uses the alpha-beta pruning algorithm, and as part of evaluating the board state. More detailed information about this distance metric can be found in this paper (see ...
GymGOne's user avatar
  • 45
0 votes
0 answers
66 views

As an exercise, to get a good idea of what Z3 can and can't do, I was trying to solve a "coraline" puzzle. This is a rectangular grid, where each square is a graph node of degree two: each ...
David Detlefs's user avatar
-1 votes
1 answer
84 views

I'm trying to solve the Binary Tree Longest Consecutive Sequence II problem (Leetcode 549). The goal is to find the length of the longest consecutive path (increasing or decreasing) in a binary tree. ...
fortnight learner's user avatar
4 votes
2 answers
184 views

I am fairly new to assembly. After compiling, when I run the code below, I get a segmentation fault. I am trying inline assembly with recursion. I am compiling this code with cxxdroid. int ...
Steven Vanhaeren's user avatar
2 votes
1 answer
75 views

I'm trying to implement a recursive factorial function in M68K assembly using the stack to pass parameters. The code almost works: the recursion and multiplication behave as expected, and D0 contains ...
alex770's user avatar
  • 31
0 votes
0 answers
54 views

DAO has methods that return completableFuture. To avoid fetching huge result at once, I want to fetch it in pages from DB. The recursive solution stops when result size < pageSize However, to avoid ...
bhosleviraj's user avatar
1 vote
2 answers
104 views

I'm working out of Scala for the Impatient (3rd Edition). (I'm not doing this for a class.). I'm trying to implement a factorial function using to and reduceLeft without a loop or recursion. This ...
Christopher Spears's user avatar
0 votes
1 answer
43 views

exp: 'a' exp | 'a'; If the input is just an 'a', I get a error. Doesn't antlr4 support direct right recursive? I have noticed that antlr4 supports direct left and right recursive. Why this simple ...
Frank's user avatar
  • 1
1 vote
1 answer
41 views

I'm beginning with programming with Lua and want to create a plugin that loops through a folder structure and creates Published collection sets (and smart collection sets afterward). I've come this ...
Keymaster's user avatar
0 votes
1 answer
43 views

its a task for my uni, and i thought i would be able to make it, but its the 5th day in a raw. i have to make in recursive, and i have to make it sort by selection, so I am sorting surnames by ...
NikPlayAnon's user avatar
1 vote
1 answer
141 views

I'm working on converting an old database and queries to recursive CTEs. In the current code, I'm storing hierarchical data as a dash separated list of 0 padded strings. So as an example, I may have ...
Rohit's user avatar
  • 3,230
4 votes
1 answer
147 views

int main() { auto fn = []<typename T>(this auto&& self, T n) { if (n > 0) { self(n - 1); } }; fn(3); } Compiled with clang-20 -std=c++23 but ...
xmllmx's user avatar
  • 44.5k
-3 votes
2 answers
244 views

I'm trying to implement a recursive power function in C++, but it fails with large n due to stack overflow. Here's the code: class Solution { public: double myPow(double x, int n) { long ...
Riya Kumari's user avatar
-1 votes
1 answer
73 views

I am struggling to understand the recursion going on in the insert, _insert_recursive and _inroder_traversal methods. For context, I know recursion and the concept is not strange to me, I struggle to ...
kmmensah's user avatar
2 votes
3 answers
147 views

Disclaimer: Yes, this is for an assignment, but I think I have an alternative solution already. I just want to figure out why this initial attempt did not work because I can't understand why it isn't ...
aDiv's user avatar
  • 31
0 votes
1 answer
48 views

Basically I need a less stupid way to do this: var x = getElementById('not-important'); x.parentElement.parentElement.parentElement.parentElement....parentElement.style.display = 'none'; In my case ...
Dan Mantyla's user avatar
  • 1,892
1 vote
3 answers
117 views

I have an array of some parameters (like a YAML config file) and this need to be written to database finaly with primary ids and so on. For example this is a part of my array: $settings = [ 'basic'...
Joeker's user avatar
  • 123
0 votes
1 answer
44 views

I'm working on a Jekyll site and encountering a "Nesting too deep" error when trying to render nested comments using a recursive include. Here's a simplified version of my template: {% ...
quarks's user avatar
  • 35.7k
0 votes
1 answer
80 views

Hello I basically need to implement a recursive function for insertion of a binary tree. I already implemented the chunk of insertion function (wether it's largest or smaller than root) but there's an ...
Cool Dude's user avatar
-1 votes
3 answers
159 views

I'm trying to solve a variation of the LeetCode "Decode String" problem in JavaScript. The adapted challenge could be formulated as: Given an encoded string, return its decoded string. The ...
Kapil Sharma's user avatar
1 vote
1 answer
75 views

I am writing a recursive function to create all possible subsequences of a string and return the set of strings as a vector. This is a challenge from Coding Ninjas. I recurse over each char in the ...
Aayush's user avatar
  • 13
-3 votes
1 answer
107 views

I have trouble resolving a recursion issue, how can I build a class which would behave like this: print the requested attributes from it: o.foo.bar would print "o.foo.bar" when called. same ...
fedixal's user avatar

1
2 3 4 5
949