My assignment: Consider two arrays a and b where each consists of n integers. In one operation: Select two indices i and j (0 <= i,j < n) Swap integers a
I'm working on the Island Perimeter Problem from LeetCode. I tried to use the DFS algorithm, based on LeetCode#200, to solve this problem. For example 1, the ou
I am trying to implement a graph using HashMap where I store the nodes (vertices) on the key column and the adjacent nodes ( adjacent list ) as a HashSet on the
My Code ↓ Some macros defined by #include <stdio.h> #include <malloc.h> #define ElementType int #define ERROR 0 // 队列ஷ
I want to store non-rectangular data in a structure, e.g. in a list. Referencing previous data works using a tibble, e.g. like this: dat <- tibble(a = 2,
I have a database where there are products grouped by categories. When a user registers, he selects a category, which cannot be changed. The user will be able t
I came upon object graphs while studying. And while they seem "cool" and useful, a related problem to the material made absolutely no sense to me. public class
i came across this question where i was tasked to convert a tuple into binary tree and then convert binary tree back to tuple and return both tree and tuple. i
From a theoretical perspective, I'm interested in learning how one would correctly describe a numbering system that starts counting from x at the y position in
I have a dataclass called Config that is created through the properties and values of a dictionary. Since this dictionary can have nested dictionaries, i would
The question is to distribute candies to N children.Each child has a rating. Distribution should be such that each child have at least one candy and children wi
First, I make circular linked list that look like 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> (head) Now, I am trying to convert this circular linked list
So I know how the reduce, accumulator and how fold works in C++, Python, etc... But for some reason in Scade Suite it's kinda confusing to me. Scade Suite Examp
Problem: You are given an array of integers that contain numbers in random order. Write a program to find and return the number which occurs the maximum
I know that one can detect cycles in direct graphs using DFS and BFS. I want to know whether we can detect cycles in directed graphs using Union-Find or not? I
My code to access elements of array using for loop. The output of the program is [19,17,15] which are the elements of array int a[] = { 12, 15, 16, 17, 19, 23 }
According to the manual there are 4 types of ETS tables: set – The table is a set table: one key, one object, no order among objects. This is the default
I am currently practicing algorithms and DS. I have stumbled upon a question that I can't figure out how to solve. So the question's link is there: In summary,
The only reason I see for using merge sort over quick sort is if the list was already (or mostly) sorted. Merge sort requires more space as it creates an extra
I have a dataset with multiple individuals and two variables from different points of time, for example: Company Employees at t=1 (before a specific event) Rev