Skip to main content
Filter by
Sorted by
Tagged with
-2 votes
0 answers
36 views

I just started playing around with Common Lisp and tried the first euler problem which states to sum all the divisors of 3 OR 5 under some given parameter x. I would like to use a recursive solution ...
Patrick Donegan's user avatar
3 votes
2 answers
156 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
115 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
1 vote
2 answers
151 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
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
2 votes
1 answer
105 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
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
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
14 votes
1 answer
361 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,147
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
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
4 votes
2 answers
81 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
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
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
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
4 votes
2 answers
185 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
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
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
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
4 votes
1 answer
151 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.6k
-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
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
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
-1 votes
3 answers
160 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
-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