Category "data-structures"

minimum number of jumps dynamic programming

I wrote this code to solve a problem called minimum number of jumps which basically asks what are the minimum number of jumps it takes to get from the beginning

Getting Segmentation Fault in the problem "Maximum Rectangular Area in a Histogram" on GFG

Problem: Maximum Rectangular Area in a Histogram link: https://practice.geeksforgeeks.org/problems/maximum-rectangular-area-in-a-histogram-1587115620/1 Website:

6- Write this client method using only the push(), top(), pop(), and isEmpty()

6- Write this client method using only the push(), top(), pop(), and isEmpty() methods: public static void reverse(ArrayStack stack) // reverses the contents

What is the difference between these two codes? (Python: circular singly linked list)

These are the codes for __iter__ method of a circular singly linked list. But I don't understand the difference between the two. def __iter__(self): node =

What is the difference between these two codes? (Python: circular singly linked list)

These are the codes for __iter__ method of a circular singly linked list. But I don't understand the difference between the two. def __iter__(self): node =

Does the code load the data on the linked list?

Does the code load the data on the linked list? and the printing method to verify that the data is present in the linkedlist, is it correct? This is the data fo

How to create a nested data structure from 2 arrays?

Hi guys I get confused trying to qcheave this, so any help would be great! I have two arrays from which I need a specific object. Source arrays: 1-Types (1D):

BubbleDown function(min heap) not working

I have generated a minheap to this file but I think something I have missed but I can't identify what are the things I have missed. I have missed something on

How to get list of palindrome in text? [closed]

I have the following interview question that may require traversing through the entire string. Problem I searched about find Problem and most

how to alter reduce function so it produce different result

I have this array: data: [ '+section1+', 'big text 1 here.', 'big text 2 here followed by list:', '-this is list item;', '-this is another list item;'

Transform array into object with custom properties

I have this array myarr = [ '=title1', 'longText0...', 'longtText1...', '=title2', 'longTextA...', 'longtTextB...', 'longtTextC...' ]; symbo

Directed SPT vs SPT?

Question: If a graph contains no negative-weight cycles, does there exist an ordering of edges such that Bellman-Ford computes shortest paths by relaxing each e

How to insert records into a Nested HashMap?

I want to create a nested HashMap of: var myHashMap = new HashMap<String, HashMap<String, int>>(); And I want to insert records into the inner Hash

Circular linked list not working after appending 3rd node

It's Showing output for 2 nodes but after adding 3rd node it doesn't showing any output, what i'm doing anything wrong?? This is the append method that i have

Is there a way to make a node of Linkedlist point to a node that isnt next in the list

I am making a snakes and ladders game in C using a LinkedList, I have a square struct that represents squares on the board. I need to add snakes and ladder that

insert zk log check in and out to one row in database

I am retrieving data from ZK attendance device using zkteco-sdk-php. The out come is like this UID ID NAME STATE DATE TIME TYPE 55 275 Employ1 Fingerprint 19-0

Python modulo returning wrong answer

I was attempting this question on leetcode using python3. My solution for this problem is as follows: class Solution: def __init__(self): self.memo

Tokenize a std::string to a struct

Let's say I have the following string that I want to tokenize as per the delimiter '>': std::string veg = "orange>kiwi>apple>potato"; I want every

Find the maximum number of distinct elements that can be achieved in array a after at most k operations

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

Island perimeter problem - cannot count all neighbor cells

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