Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
1 answer
148 views

Can I optimize my implementation of generating Fibonacci series using recursion?

My function accepts a number, which generates total Fibonacci numbers. I am using recursion. Please follow the code below, ...
Rahul Shivsharan's user avatar
2 votes
2 answers
177 views

Recursive Transversal (Python)

For a programming challenge I was doing, I needed to traverse a list of lists, and while writing the standard 2D traversal function, I thought why not generalise it, so I did. Here's my best effort: ...
Tobi Alafin's user avatar
  • 1,792
3 votes
1 answer
672 views

Checking whether given array is sorted by divide-and-conquer

I've written a code that I try to use divide and conquer approach to determine if the given array is sorted. I wonder whether I apply the approach accurately. ...
Soner from The Ottoman Empire's user avatar
3 votes
3 answers
2k views

Tower Hopper problem recursive approach

The Tower Hopper problem gives us an array of values representing heights that express how far we can jump from a certain tower, and asks whether there's a way to get from ...
jeremy radcliff's user avatar
7 votes
1 answer
957 views

Finding Second Largest Element in an Array

Here's my implementation using divide and conquer in C++. What do you think of this implementation regarding running time ? ...
Ahmed Karaman's user avatar
3 votes
1 answer
446 views

Find the maximum possible summation of differences of consecutive elements

Array A contains the elements, \$A_1,A_2, \ldots, A_N\$. And array B contains the elements, \$B_1,B_2, \ldots, B_N\$. There is a relationship between \$A_i\$ and \$B_i\$: any element \$A_i\$ ...
kumarmo2's user avatar
  • 261
1 vote
2 answers
3k views

Filtering on an array of object literal properties and their nested array values

This is a function which filters on multiple object properties and their corresponding arrays. I need to match all properties to a pattern and have an array as their property value. Properties that ...
Rick's user avatar
  • 586
1 vote
1 answer
151 views

Object-to-array flattening function

I have written a function that is designed to convert an object into an array of key/pair values ("flattening it") like so: Input ...
Jack Wilsdon's user avatar
  • 1,661
8 votes
2 answers
8k views

Recursively evaluate neighbors in a two dimensional grid

I'm creating a puzzle mini game where there is a board of gems, varying in color, and chosen at random. This is what my code generates: When you click on a gem the game should traverse the board and ...
Nick Savage's user avatar