min Questions

4

Solved

I have been trying to figure this out for a while and need some help. I need to find the min/max values and print them out for a multidimensional array. Here are the two ways that I have tried. im...
Devalue asked 9/7, 2016 at 20:45

3

Solved

I have input array A A[0], A[1], ... , A[N-1] I want function Max(T,A) which return B represent max value on A over previous moving window of size T where B[i+T] = Max(A[i], A[i+T]) By usin...
Ratchet asked 30/8, 2012 at 5:1

7

I have a vector of doubles. I wish to find both: The minimum value in the vector that is greater than (or equal to) a value x. The maximum value in the vector that is less than (or equal to) a va...
Thickening asked 27/11, 2015 at 10:55

2

Solved

I'm working on a problem here where I have two vector objects in my code: one is a vector<string>, and the other a vector<unsigned> that I'm passing as a const ref to some function. I'm...
Tamqrah asked 12/12, 2017 at 6:15

5

Solved

I want to limit a number to be within a certain range. Currently, I am doing the following: minN = 1 maxN = 10 n = something() #some return value from a function n = max(minN, n) n = min(max...
Norvil asked 13/5, 2011 at 19:34

1

Solved

I have put validation for the following field, @Min(1) @Max(500) private int length; however, the length isn't a required field but when I didn't give the "length" in the input, I got this erro...
Autolysin asked 29/9, 2017 at 17:0

6

I have this part of code <input type="number" min="2" max="10" step="2" id="contact" oninput="new_sum"> In the field I can insert a number > 10 and < 2. How can I limit it?
Empire asked 22/6, 2014 at 17:22

5

Solved

I need to generate random numbers with following properties. Min should be 200 Max should be 20000 Average(mean) is 500. Optional: 75th percentile to be 5000 Definitely it is not uniform distr...
Reitareiter asked 15/3, 2011 at 15:51

1

Solved

I have a data.frame with columns of factors, on which I want to compute a max (or min, or quantiles). I can't use these functions on factors, but I want to. Here's some example : set.seed(3) df1...
Macnamara asked 19/7, 2017 at 16:21

4

Solved

I want to fetch the lowest value in the hash. Input: test = {'a'=> 1, 'b'=> 2, 'c' => 0.4, 'd' => 0.32, 'e' => 0.03, 'f' => 0.02, 'g'=> 0.1} Expected result: {'f'=> 0....
Weinert asked 5/6, 2014 at 11:33

1

Following https://mcmap.net/q/377885/-find-the-smallest-amongst-3-numbers-in-c-duplicate I am trying to compare three numbers: #include <iostream> int main() { std::cout << std::min...
Stacy asked 15/6, 2017 at 8:1

2

Solved

I am trying to understand how this works: my_dict = {'a':2,'b':1} min(my_dict, key=my_dict.get) produces b Which is a really cool feature and one I want to understand better. Based on the doc...
Hillside asked 8/4, 2016 at 14:41

3

Solved

I have a Dataframe: df = A B C D DATA_DATE 20170103 5.0 3.0 NaN NaN 20170104 NaN NaN NaN 1.0 20170105 1.0 NaN 2.0 3.0 And I have a series s = DATA_DATE 20170103 4.0 20170104 0.0 20170105 2.2...
Ogg asked 16/5, 2017 at 22:10

5

Solved

If I have a text and I only want to allow the user enter text between 5 and 10 characters long, how do I do this using javascipt? I have tried using mix and max functions but they only works for n...
Hypesthesia asked 16/1, 2014 at 21:13

4

Solved

which.max and which.min will return the smallest index of the max or min value if there are ties. Is there a way around this so that the largest index is returned without affecting the efficiency...
Madras asked 26/3, 2013 at 5:31

3

Solved

Enumerable#max_by and Enumerable#min_by return one of the relevant elements (presumably the first one) when there are multiple max/min elements in the receiver. For example, the following: [1, 2, ...
Masurium asked 1/3, 2014 at 15:0

3

Solved

Let's say I have a table like this: name | score_a | score_b -----+---------+-------- Joe | 100 | 24 Sam | 96 | 438 Bob | 76 | 101 ... | ... | ... I'd like to select the minimum of score_a a...
Clandestine asked 25/11, 2008 at 21:44

3

Solved

Given the following data frames: d1=pd.DataFrame({'A':[1,2,np.nan],'B':[np.nan,5,6]}) d1.index=['A','B','E'] A B A 1.0 NaN B 2.0 5.0 E NaN 6.0 d2=pd.DataFrame({'A':[4,2,np.nan,4],'B':[4,2,np.na...
Irrelevant asked 12/4, 2017 at 17:39

4

Solved

In python, which one is faster ? numpy.max(), numpy.min() or max(), min() My list/array length varies from 2 to 600. Which one should I use to save some run time ?
Stochmal asked 8/6, 2012 at 4:31

4

Given a matrix, it's easy to compute the value and index of the min value: A = rand(10); [value, index] = min(A(:)); However I would also like to recover the second min value (idem for max). I ...
Diaz asked 27/2, 2017 at 10:58

1

Solved

I have a pandas dataframe with a column made of lists. The goal is to find the min of every list in row (in an efficient way). E.g. import pandas as pd df = pd.DataFrame(columns=['Lists', 'Min'])...
Kiri asked 6/2, 2017 at 9:44

3

Solved

I have a np.ndarray as follows: [[ inf 1. 3. 2. 1.] [ inf inf 2. 3. 2.] [ inf inf inf 5. 4.] [ inf inf inf inf 1.] [ inf inf inf inf inf]] Is there a way to get the indices and values of th...
See asked 1/2, 2017 at 1:25

4

Solved

std::minmax_element : returns a pair consisting of an iterator to the smallest element as the first element and an iterator to the greatest element as the second. std::min_element : returns an ite...
Cralg asked 27/10, 2016 at 11:37

3

Solved

Here is the test program: void testFunc() { double maxValue = DBL_MAX; double slope = std::numeric_limits<double>::quiet_NaN(); std::cout << "slope is " << slope << std...
Forelimb asked 7/10, 2016 at 13:58

3

I am testing OpenMP min reduction. If I write my code like the following, it will return the correct result: res = 3. #include <omp.h> #include <iostream> #include <algorithm> i...
Malonylurea asked 8/9, 2016 at 14:30

© 2022 - 2024 — McMap. All rights reserved.