Skip to main content

All Questions

Tagged with or
-2 votes
2 answers
78 views

I'm doing a coding exercise. I must create a recursive function that return the depth of an object. Said object has several properties and arrays of children, emulating a family tree: const foo = { ...
Annie McGarden's user avatar
0 votes
0 answers
96 views

In some problems like permutations, we fill positions one by one, while in others like subsets or partitioning, we move ahead based on the elements we have already chosen. Why do these problems move ...
Anchal Dobriyal's user avatar
2 votes
1 answer
69 views

I have a self-referencing Laravel model for a category tree. Each node can have children, and I want to delete a node together with all of its descendants. My relationship looks like this: public ...
bcExpt1123's user avatar
Best practices
0 votes
5 replies
77 views

I have started and stopped DSA multiple times on arrays and Strings but this time I want to do it whatever it takes and someone from my known give me advice that if I get a good hand on recursion and ...
Yogendra Singh's user avatar
Best practices
0 votes
3 replies
77 views

I am currently working through a daily DSA challenge using Java, and recursion keeps tripping me up. I've tried learning it a few times, but I lose track of the execution flow, especially when a ...
Yogendra Singh's user avatar
-3 votes
1 answer
174 views

I have an JavaScript array like this: let myArray = [ { name: 'Alice', children: ['Bob', 'Bill'] }, { name: 'Bob', children: 'Cindy' }, { name: 'Bill', children: [] }, { name: 'Cindy', ...
Wernfried Domscheit's user avatar
0 votes
2 answers
117 views

My script for batch downloading a set of LibreText open textbooks prepares a list of links: #!/bin/bash function recurse_directories { S="$1" echo "S=$S" r="$(echo "$S&...
Signor Pizza's user avatar
3 votes
2 answers
171 views

I'm making a small project to play "escoba", a Spanish card game. I need to get all the ways to sum up to 15 with a number of cards (up to 16) on the table and 1 card from my hand. To save ...
Durumator's user avatar
2 votes
3 answers
348 views

/** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ int maxDepth(struct TreeNode *root) { if (root ...
Leonuraht's user avatar
3 votes
2 answers
86 views

I am trying to solve the exercise 1.22 in SICP with ChezScheme on my MacOS, I did some reading here and found out I could use time procedure to get the CPU runtime of any other procedure. I couldn't ...
classikcherrywood's user avatar
1 vote
2 answers
97 views

I am trying to understand how recursion and backtracking work in the following Java method that prints all subsets of a string. I understand the base case where idx == s.length() and the current value ...
Rajkumar Patil's user avatar
Advice
2 votes
4 replies
76 views

0-1 Knapsack problem is often used as a starting problem to understand dynamic programming. This problem can also be solved using backtracking. Now, backtracking explores all possible subsets and uses ...
Hades's user avatar
  • 11
7 votes
1 answer
118 views

Below code is from nmap tableaux.lua script file which is located at /usr/share/nmap/nselib local tcopy_local function tcopy(t) local tc = {} for k, v in pairs(t) do if type(v) == "table&...
Yilmaz's user avatar
  • 51.4k
-2 votes
1 answer
118 views

I’ve found a way to remove the annoying thumbs file that prevents me from deleting folders. Currently, I go into a folder, shift-click “run power shell window here and then type: rm thumbs.db -force ...
mrshmuga9's user avatar
9 votes
1 answer
347 views

I have table of structure data in SQL Server. I want to travese the tree and find all nodes with a recursive query. Additionally, the structure data is versioned. I want to always use the latest ...
Truncated's user avatar
  • 103

15 30 50 per page
1
2 3 4 5
3162