Skip to main content

Questions tagged [recursion]

Recursion in computer science is a method of problem solving where the solution to a problem depends on solutions to smaller instances of the same problem.

Filter by
Sorted by
Tagged with
11 votes
2 answers
496 views

Problem I'm seeking a clean and efficient way to determine whether one string is an initialism/acronym of another. Example: IBM => International Business Machines However, a key condition for my ...
Ian's user avatar
  • 233
4 votes
2 answers
194 views

This is a follow-up question for A recursive_count Function For Various Type Arbitrary Nested Iterable Implementation in C++, A recursive_count_if Function with Unwrap Level for Various Type Arbitrary ...
JimmyHu's user avatar
  • 7,575
1 vote
1 answer
215 views

The code below is an implementation of purely recursive solution to find a powerset of any given set. The input set is a string, and the output - array of strings. Both of them are wrapped into a ...
anfauglit's user avatar
  • 113
4 votes
2 answers
110 views

I devised a new primality test isPrimeNumber() below which determines if 1000000007 is prime. It works fine but the code looks unprofessional in my opinion. Is there any way to refactor it to make it ...
vengy's user avatar
  • 203
1 vote
1 answer
138 views

This is a follow-up question for A recursive_replace_if Template Function Implementation in C++, A recursive_copy_if Template Function Implementation in C++, A recursive_count_if Function with Unwrap ...
JimmyHu's user avatar
  • 7,575
2 votes
1 answer
138 views

This is a follow-up question for A recursive_copy_if Template Function Implementation in C++. Besides the recursive version std::ranges::copy_if, I am trying to ...
JimmyHu's user avatar
  • 7,575
2 votes
1 answer
98 views

This is a follow-up question for A recursive_transform for std::vector with various return type and A recursive_transform Template Function Implementation with std::invocable concept in C++. Besides ...
JimmyHu's user avatar
  • 7,575
1 vote
1 answer
133 views

This is a follow-up question for A recursive_transform Template Function Implementation with std::invocable concept in C++, A recursive_transform Template Function Implementation with std::invocable ...
JimmyHu's user avatar
  • 7,575
5 votes
2 answers
409 views

This is a follow-up question for A recursive_transform Template Function Implementation with std::invocable concept in C++, A recursive_transform Template Function ...
JimmyHu's user avatar
  • 7,575
2 votes
1 answer
151 views

This is a follow-up question for A recursive_transform Template Function Implementation with std::invocable concept in C++ and A recursive_transform Template ...
JimmyHu's user avatar
  • 7,575
3 votes
1 answer
286 views

This is a follow-up question for A recursive_transform for std::vector with various return type, A recursive_transform Template Function with Execution Policy, A recursive_count_if Template Function ...
JimmyHu's user avatar
  • 7,575
2 votes
1 answer
208 views

This is a follow-up question for Avoiding requires clause if possible on a series recursive function in C++ and A recursive_count_if Function with Automatic Type Deducing from Lambda for Various Type ...
JimmyHu's user avatar
  • 7,575
1 vote
1 answer
200 views

This is a follow-up question for A recursive_transform_reduce Function for Various Type Arbitrary Nested Iterable Implementation in C++, A recursive_count Function For Various Type Arbitrary Nested ...
JimmyHu's user avatar
  • 7,575
2 votes
1 answer
156 views

This is a follow-up question for A population_variance Function For Various Type Arbitrary Nested Iterable Implementation in C++. Thanks to G. Sliepen's answer, I am trying to implement the mentioned <...
JimmyHu's user avatar
  • 7,575
1 vote
1 answer
135 views

This is a follow-up question for A Summation Function For Various Type Arbitrary Nested Iterable Implementation in C++, An arithmetic_mean Function For Various Type Arbitrary Nested Iterable ...
JimmyHu's user avatar
  • 7,575
6 votes
1 answer
222 views

This is a follow-up question for std::array and std::vector Type Arbitrary Nested Iterable Generator Functions Implementation in C++ and std::deque and std::list Type Arbitrary Nested Iterable ...
JimmyHu's user avatar
  • 7,575
6 votes
1 answer
197 views

This is a follow-up question for A non-nested test_vectors_generator Function for arithmetic_mean Function Testing in C++ and An arithmetic_mean Function For Various Type Arbitrary Nested Iterable ...
JimmyHu's user avatar
  • 7,575
3 votes
2 answers
1k views

I am trying to pretty print the directory structure defined in a JSON. I do have a solution using recursion but I'm looking for feedback on how this solution can be ...
Vinay Sharma's user avatar
2 votes
1 answer
152 views

This is a follow-up question for An arithmetic_mean Function For Various Type Arbitrary Nested Iterable Implementation in C++. As Toby Speight's answer mentioned, some self-checking unit tests are ...
JimmyHu's user avatar
  • 7,575
2 votes
1 answer
156 views

This is a follow-up question for A recursive_count Function For Various Type Arbitrary Nested Iterable Implementation in C++ and A Summation Function For Boost.MultiArray in C++. I am trying to ...
JimmyHu's user avatar
  • 7,575
1 vote
3 answers
227 views

It should return true, if there is no element that follow or the following elements are greater than their predecessors. ...
milesmorales's user avatar
3 votes
0 answers
321 views

https://leetcode.com/problems/stone-game/ Alex and Lee play a game with piles of stones. There are an even number of piles arranged in a row, and each pile has a positive integer number of stones ...
Gilad's user avatar
  • 5,443
3 votes
1 answer
278 views

This is a follow-up question for the previous questions about recursive functions, including A Summation Function For Arbitrary Nested Vector Implementation In C++, A recursive_count_if Function For ...
JimmyHu's user avatar
  • 7,575
3 votes
1 answer
103 views

This is a follow-up question for A recursive_count_if Function For Various Type Arbitrary Nested Iterable Implementation in C++, A recursive_count_if Function with Specified value_type for Various ...
JimmyHu's user avatar
  • 7,575
3 votes
1 answer
149 views

This is a follow-up question for A recursive_count_if Function For Various Type Arbitrary Nested Iterable Implementation in C++ and A recursive_count_if Function with Specified value_type for Various ...
JimmyHu's user avatar
  • 7,575
11 votes
3 answers
1k views

This is a simple program that solves a given Sudoku puzzle recursively. The input is provided as a file that contains the cells, 0 if empty, delimited by a , ...
adityagnet's user avatar
3 votes
0 answers
92 views

This is a follow-up question for A recursive_count_if Function For Various Type Arbitrary Nested Iterable Implementation in C++. Thanks to Quuxplusone's answer and G. Sliepen's comments. Based on the ...
JimmyHu's user avatar
  • 7,575
6 votes
3 answers
2k views

I was asked to create a method that would: Return a Change object or null if there was no possible change The "machine" has unlimited bills of: 2, 5 and 10 The Change object must return the ...
Esteban Rincon's user avatar
2 votes
1 answer
255 views

This is a follow-up question for A recursive_count Function For Various Type Arbitrary Nested Iterable Implementation in C++. Thanks to G. Sliepen's answer. Based on the mentioned suggestion, the ...
JimmyHu's user avatar
  • 7,575
5 votes
1 answer
173 views

This is a follow-up question for A Summation Function For Arbitrary Nested Vector Implementation In C++ and A Summation Function For Various Type Arbitrary Nested Iterable Implementation in C++. ...
JimmyHu's user avatar
  • 7,575
3 votes
1 answer
218 views

This is a follow-up question for A recursive_transform for std::vector with various return type, A recursive_transform Function For Various Type Nested Iterable With std::variant Implementation in C++ ...
JimmyHu's user avatar
  • 7,575
5 votes
2 answers
203 views

I made a word searching app that allows the user to input words into a text box, and parts of the word grid will be highlighted to show the location of the words. The letters of the grid can be edited ...
Chocolate's user avatar
  • 1,044
2 votes
1 answer
174 views

This is a follow-up question for An Element-wise Increment and Decrement Operator For Boost.MultiArray in C++ and A recursive_transform Template Function for BoostMultiArray. I am trying to implement ...
JimmyHu's user avatar
  • 7,575
1 vote
1 answer
121 views

This is a follow-up question for A recursive_transform Template Function for BoostMultiArray and An Add/Minus Operator For Boost.MultiArray in C++. Besides the add / minus operator for Boost....
JimmyHu's user avatar
  • 7,575
8 votes
4 answers
647 views

I needed to write a Python generator that lazily generates, in lexicographical order, strings composed of a certain alphabet (e.g. lowercase English letters). My first thought was to make an infinite ...
Anakhand's user avatar
  • 645
3 votes
1 answer
145 views

This is a follow-up question for A Sine Template Function For Boost.MultiArray in C++, A recursive_transform for std::array with various return type, A recursive_transform for std::vector with various ...
JimmyHu's user avatar
  • 7,575
1 vote
1 answer
208 views

I am trying to learn recursion and have a question involving an array that needs to be reversed. I am focusing on c# but the language probably doesn't matter a whole lot because my function is not ...
stupidQuestions's user avatar
0 votes
1 answer
435 views

🧩 Objective Write a recursive method for generating all permutations of an input string. Return them as a set. See: Recursive String Permutations - Interview Cake 🔎 Questions 1: How does the ...
adamhurwitz.eth's user avatar
2 votes
1 answer
128 views

This is a follow-up question for An element_wise_add Function For Boost.MultiArray in C++. Besides the basic add operation applying onto each element, I am trying to implement a sine template function ...
JimmyHu's user avatar
  • 7,575
3 votes
0 answers
185 views

This is a follow-up question for An element_wise_add Function For Boost.MultiArray in C++ and An Add/Minus Operator For Boost.MultiArray in C++. Besides the basic element-wise add / minus operations, ...
JimmyHu's user avatar
  • 7,575
3 votes
1 answer
234 views

Hi I participated in Leetcode weekly contest 213 and am facing issue with submission for below question Kth Smallest Instructions Bob is standing at cell (0, 0), and he wants to reach destination: (...
Saitama's user avatar
  • 155
4 votes
1 answer
184 views

This is a follow-up question for An element_wise_add Function For Boost.MultiArray in C++. The following code is the improved version based on G. Sliepen's answer. On the other hand, the built-in ...
JimmyHu's user avatar
  • 7,575
3 votes
1 answer
184 views

This is a follow-up question for A Summation Function For Boost.MultiArray in C++. Besides the summation operation of all elements, I am trying to focus on the element-wise operation here. The main ...
JimmyHu's user avatar
  • 7,575
5 votes
1 answer
348 views

This is a follow-up question for A Summation Function For Arbitrary Nested Vector Implementation In C++ and A Summation Function For Various Type Arbitrary Nested Iterable Implementation in C++. I am ...
JimmyHu's user avatar
  • 7,575
3 votes
0 answers
183 views

This is a follow-up question for A recursive_transform for std::vector with various return type and A recursive_transform for std::array with various return type. Based on these discussion about the ...
JimmyHu's user avatar
  • 7,575
7 votes
1 answer
484 views

This is the follow-up question for A recursive_transform Function For Various Type Nested Iterable With std::variant Implementation in C++ and A get_from_variant function in C++. Thanks to G. Sliepen ...
JimmyHu's user avatar
  • 7,575
6 votes
1 answer
165 views

Goal To determine the coordinates of some signal source in a 3D space, given the coordinates of four observers and the time at which each saw the signal, as well as the velocity of the signal. ...
10GeV's user avatar
  • 305
4 votes
1 answer
271 views

This is a follow-up question for A TransformAll Function For Various Type Arbitrary Nested Iterable Implementation in C++. The following code is the improved version based on G. Sliepen's answer. In ...
JimmyHu's user avatar
  • 7,575
5 votes
1 answer
298 views

I'm learning Clojure and am a rank n00b at it, trying to learn from books and online tutorials (but I'm sometimes concerned that I am picking up bad habits or at least not all the good habits). For ...
frIT's user avatar
  • 153
4 votes
1 answer
231 views

This is the follow-up question for A Summation Function For Various Type Arbitrary Nested Iterable Implementation in C++ and A Maximum Function For Various Type Arbitrary Nested Iterable ...
JimmyHu's user avatar
  • 7,575

1 2 3
4
5
23