
I am trying to make a program to find the zeros of any given trinomial, the formula seems right but I don't know why the output is always 0, 0. I thought it was a compiler or IDE error but nope, same ...

I have a set of conditions each of which can be one of Optional, Necessary or Sufficient. Clearly the set is met if any of the sufficients are true. And if all of the necessaries are true. (Optionals ...

When attempting to derive the maximum (largest size) independent set on a graph of nodes, a solution can be arrived when the graph is a forest/tree structure. The general pseudocode for this ...

I was trying to write binary search in python. What i write is :
arr = [6, 13, 14, 25, 33, 43, 51, 53, 64, 72, 84, 93, 95, 96, 97]
def binarySearch(arr, low, high, key):
if(low <= high):
...

In a competitive environment, there are different types of questions available. Easy, medium, hard. And each of these questions have a pre determined point for the questions for that level. Also each ...

Dictionary = ["an","out","per","former","for","mer"]
String = "ANOUTPERFORMER"
RESULT = ["anoutperformer","an...

I have a set of points in 2D P(x,y) in Matlab that divide unit circle into regions. I want to create matrix with regions R(r1, r2, ...,rn) that cover unit circle area. Regions that divide unit circle ...

This is a practice question, so it is not part of an actual test.
I'm trying to understand the structure of the algorithm and I have developed a logic so far, however, I'm missing something somewhere ...

I recently solved the time complexity for the Fibonacci algorithm using recursion. This is a standard solution with a time complexity of O(2^n). I was wondering if you were to use a DP algorithm, ...

I wanted to make a nonrestoring Division algorithm. Everything compiles, but there is one issue, my Testbench says, that the simulation has failed in my attempt. But watching the waveform data it ...

We need a sorted array to perform a binary search in that case the time complexity already became greater than the linear search, so isnt linear search a better option in that case?

The following is my console log output... The user inputs the integers to add, and the index of the element they wish to switch:
enter integer to add: 4
enter another integer to add: 5
enter another ...

Given an undirected graph G = (V, E), with three vertices u, v, and w.
Describe an algorithm to determine whether
there is a path from u to w that passes through v.
Don't comment if this is from some ...

Please check in the code there is silly issue I guess and it is not working properly.
I used codechef to do my work and it really bangs my mind now,
Please check in the code there is silly issue I ...

I have a arraylist. I want to matching arrays and add last column uuid. To do this, the 2nd and 3rd indices in the array must be the same. They can be equal to 2 > 3 or 3> 2.
I want to explain ...

In the book "Cracking the Coding Interview", first exercise says "Implement an algorithm to determine if a string has all unique characters (not using additional data structures)". ...

The objective is to create a function that accepts two arguments: and array of integers and an integer that is our target, the function should return the two indexes of the array elements that add up ...

Im working on an application in python that finds free days in given bounds, with given persons times in which they aren't free. It works by creating a list of possible days and then removing the days ...

(define (pow b n)
"YOURDOCHERE"
(cond ((= n 0) 1)
((even? n) (pow (pow b (/ n 2)) 2))
((odd? n) (* b (pow (pow b (/ ( n 1) 2)) 2)))))
(define (pow b n)
&...

I have an XML file which has a 3 level deep XML tree. I want to extract all the <link> tags from that tree. The challenge here is that tree is dynamic and can be any level deep.
I have already ...

I understand that if it is necessary to implement a search in an ordered set, then we compare the data of each "cell" of the binary tree, which is the structure of the ordered set using the &...

I am currently trying to learn how to code a sliding tile puzzle with 8 tiles in Python 3. In one of the resources I've found, the person explains the Manhattan distances heuristic, but then goes on ...

Given A, a sparse matrix of binary values with 36 columns and n rows (where each row is random with the only constraint of each having at least 1 one and at most 12 ones), is it possible to find an ...

I have this road network with elevation data for every POINT and a calculated grade value for every LINESTRING:
Note: points plotted on graph are my own they do not represent the nodes on the graph ...

I run the following code in Hackerrank, but I also want to debug and test code locally using Eclipse, etc. So, what is the shortest way to run a Hackerrank code without modifying least? In the ...

I learned the notation of double hashing [(hash1(key) + i * hash2(key)) % TABLE_SIZE] couple days ago. There is a part I couldn't understand after thinking about it and searching for answer for days.
...

I’m designing an algorithm to count unique users on a set of pages, based on a 60min sliding scale
So it needs to find unique IPs (or tokens) that have hit a particular page and total up those hits ...

I'm working on an old contest problem from 2019 from this page:
https://dmoj.ca/problem/ccc19s4
You are planning a trip to visit N tourist attractions. The attractions are numbered from 1 to N and ...

In Hackerrank I cannot make the code work that I run in Eclipse. I also look at Using STDIN for inputs and STDOUT for outputs, but not found a corresponding page for Java (there are some examples for ...

i tried to import our users from a symfony Mysql app to firebase auth with the auth:import feature.
Our application use the argon2i hashing algorithme and it's not listed in the support list.
I can't ...

I am looking for an optimal assignment algorithm for the following problem.
There are n students and there are m mentors (m <= n) and 5 research topics. Each student have preferences(0 <= some ...

I recently decided to try my hand at the Euler project and already having issues with the first problem:
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9....

So when I was training a LSTM network with Keras, in order to decrease the MAE, I differed the data for several times， and the output was already exact enough. However, the output was still differed ...

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <math.h>
int function(int n);
int main () {
int i = 0;
int n = 0;
n = function(i);
printf(...

Let's Say We Have an Array Of Int :
int[] array = new int[5];
and inside of this array we have a 5 randomly numbers..
array = {10,5,7,0,3};
What Would be The Best Way To Change That array To This ...

Given a string num representing the digits of a very large integer and an integer k.
You are allowed to swap any two adjacent digits of the integer at most k times.
Return the minimum integer you can ...

Let's say now I have an array that used to describe the shape of a polygon:
[
[0.0, 1.0],
[0.5, 1.0],
[0.5, 0.3],
[1.0, 0.3],
[1.0, 0.0],
[0.0, 0.0]
]
As shown on diagram above, the blue ...

Guys I was having issue in implementing a problem using java. Problem called as "knearest distance from a point x". Here I want to solve the problem in nlogk and not nlogn so I have decided ...

I am trying to find out what is the meaning of these two following lines
N + M log N
(M + N) lg* N
Can someone suggest me what is the meaning and where to learn to read this ? Thanks.
Updated content
...

I am solving this dynamic programming question on LeetCode.com: https://leetcode.com/problems/targetsum/
You are given a list of nonnegative integers, a1, a2, ..., an, and a target, S. Now you have ...

I am working on a practice problem called sortBad. Here is the pseudocode:
sortBad(A[0···n − 1])
{
if (n = 2) and (A[0] > A[1])
swap A[0] and A[1]
else if (n > 2)
m = ⌈𝛼 ...

how can i write this code in a simple way, without function and write all in int main() ???
I need find the sum of two elements of the array as close to zero as possible in C++...
Examples:
Input:
5 1 ...

I have a list of integers and I am trying to find the unique value of a list. I can't use count() because it exceeds the time limit so I figured that using sorted() and see if the element i is not ...

Input
8
########
1 2
Output
3
Explanation
N=8 length of the cave.# means its safe to enter. * means not safe to enter.
r1 = 1 and r2 = 2
Lets start from i=1.
There are 3 ways to reach the end of N.
...

I am supposed to do a score calculator in Java for a dice game that rolls 6 dice (with 6 faces). The score is supposed to be calculated according to a list of options that the user has available. ...

I am trying to implement an algorithm that requires a postorder traversal. Here is my graph (taken from here, pg. 8):
When I try to do a postorder traversal of this, the order I get is:
[3, 2, 1, 5, ...

I am currently reading about functional data structures and algorithms and I tried different quick sort implementations. I noticed, however, that there is a lot of variation in their performances.
...

I'm running a parallel program in Fortran and using MPI. There is an algorithm that is executed by only certain parallel processors which contain a flag. I want to print a statement only once but I ...

I know how to calculate the master theorem and I managed to calculate it for best and average case.
T(n) = 2T(n/2) + Theta(n)
The worst case equation is
T(n) = T(n1) + Theta(n)
If I am correct a is 1,...

I have an undirected graph G=(V,E) and I want to extract a subgraph of G induced by a set of nodes which is subset of V. Now I am looking for the algorithm to do this in Python?