Category "recursion"

Trying to call a function within a function in Bash but it returns errors

I had looked on overflow and exchange, but I can't seem to find an answer for this. I am currently trying to make a recursive fibonacci function. However when I

Different output on recursive call using static variable [closed]

int fun1(int x){ static int n; n = 0; if(x > 0){ n++; return fun1(x-1)+n; } return 0; } int fun(int x){

Recursion puzzle with key in the box

I currently try to understand recursion on made up example. Imagine you have a briefcase, which can be opened by the key. The key is in the big box, which can c

Deep find object in tree, then return object and the path to it through the tree

I've written a recursive function to find a given object and the path within that tree, but when I change the target id (over here : if(tree.targetModuleId ===

Recursive Function using MPI library

I am using the recursive function to find determinant of a 5x5 matrix. Although this sounds a trivial problem and can be solved using OpenMP if the dimensions a

assertj recursive comparison ignoring regex failing after upgrade from 3.18.1 to 3.21.0

I have updated my springboot , along with that my assertj also seems to have upgraded. Now the test which was initially working in the older version is failing.

Given a Cerberus JSON Schema file, how can I generate a dictionary object

Problem I have a Cerberus Json schema file and I need to generate Json files based on the schemas with default values given the data_types. The key _type in th

Javascript - understanding recursive inner function

The following code prints the path of the key searched by its value inside an object: function findKeyPath(obj, keyAttr, keyValue) { let path = ""; (fu

What is a safe and scalable way to exhaustively select all users from Amazon Cognito API in JavaScript?

I am part of a small team working on a fairly small website with user accounts; there are about 100 users at this time. And we are using Amazon Cognito for user

JSONata: flattening recursion that tracks path of recursion

I have a nested, recursive JSON of arbitrary depth where a node can either be a parent of more nodes (i.e. it has a structure array containing nodes, which is t

Python pandas dataframe populate hierarchical levels from parent child

I have the following dataframe which contains Parent child relation: data = pd.DataFrame({'Parent':['a','a','b','c','c','f','q','z','k'],

Understanding how this recursive method works [duplicate]

Can someone please explain how this method works? I tried adding System.out.print statements but it didn't get me anywhere and I simply cannot

Understanding how this recursive method works [duplicate]

Can someone please explain how this method works? I tried adding System.out.print statements but it didn't get me anywhere and I simply cannot

ERD - Recursive relationship with two primary keys

I have a product table: Product (ID, Version) And I am having trouble creating a recursive table named "Update". this table should have a product ID and for eac

How to implement build in function .eval() with recursive function

Hei Coders, I have a string "1+1", with javascript build in function eval() i can do eval("1+1") so the return value will be 2 But how about if i want to imp

Recursion: Longest Palindrome Substring

This is a very common problem in which we would have to find the longest substring which is also a palindrome substring for the given input string. Now there ar

I tried to solve Best Sum problem in Python but I am not able to figure out the issue, please suggest what is wrong

The function should return an array containing the shortest combination of numbers that add up to exactly the target sum. If there are two (or more) possibiliti

Recursion - Python question, return value question

**I am having a problem with solving the question below. Implement the sum_positive_numbers function, as a recursive function that returns the sum of all positi

generating all permuated products from a map is not working

My code: #include <bits/stdc++.h> using namespace std; using ll = long long; vector<ll> generate_all(map<ll, int> mp, int keys

React: How to Animate Expanding and Collapsing Div When the Size of the Content is Not Knowable

Question: I have a React functional component that recursively renders nested lists. That part is working fine. The part that I am struggling with is getting t