There are 3 piles (1 pile - 7 matches, 2 pile - 5 matches, 3 pile - 3 matches) you can take any number of matches, but only from one pile, the one who takes the
Description of my code: For example, take n = 3, and let p [i] be 1 2 3. For beginnings, max = 0. I take in this order the sequences: 1, 1 + 2, 1 + 2 + 3, 2, 2
There are 3 piles (1 pile - 7 matches, 2 pile - 5 matches, 3 pile - 3 matches) you can take any number of matches, but only from one pile, the
I have a large bipartite graph and I can find a maximum matching quickly using Hopcroft-Karp. But what I would really like is a few hundred different maximum ma
I am trying to learn how to detect cycle. I see many example of using recursion but I want to implement in iterative way. Here is my code public boolean cycleDe
I need to sort vector of structures by a given field. To anyone who faces the same problem: I just made my own sort function and there you can pass in lambda as
I am trying to get better understanding of Tarjan's algorithm for finding SCC, articulation points and bridges. I am considering a special case where the graph
I'm currently learning as much as I can about recursion but I'm really stuck on how to use it to check whether all the number elements in an array are even numb
I have the following interview question that may require traversing through the entire string. Problem I searched about find Problem and most
I am trying to implement an efficient precomputed culling scheme in my 3D city model viewer program (a user can upload a 3D model of a city from any number of a
I have this code that works perfectly but in the opposite direction ( left ) I would like to rotate this array to the right, how can I do this? public int[] Ro
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
Faced this question in an interview, which basically stated Find if the given two strings are anagrams of each other in O(N) time without any extra space I tr
I need to generate (iterator) a random sequence of 32 bit integers with absolutely no repeats. The naive solutions to this problem don't work for me because of
Given lots of intervals [ai, bi], find the interval that contains the most number of intervals. I easily know how to do this in O(n^2) but I must do it in O(nlo
This code is currently showing the total amount needed to reach the next level, but what I would like it to do is show the complete total amount so for example
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
Say I have an array: [44, 30, 24, 32, 35, 30, 40, 38, 15] Here, every number represents a stock value on a certain day. I want to find the maximum profit that
The problem: In this task, you need to write a regular segment tree for the sum. Input The first line contains two integers n and m (1≤n,m≤100000), the s
I was attempting this question on leetcode using python3. My solution for this problem is as follows: class Solution: def __init__(self): self.memo