Skip to main content

Questions tagged [interval]

For code using intervals to measure “distance” between values, possibly as input, output, or in method calls.

3 votes
1 answer
105 views

Range exclusion function

I have a range of lines in a text file defined by the start and end line number (inclusive) of the range (e.g. (1, 200)). I would like to to exclude some other line ...
Nils's user avatar
  • 131
9 votes
2 answers
648 views

Advent of code 2023 day 5 in Java: mapping integer ranges to new integer ranges

Context I'll be passing an interview coding test in java soon. I am experienced with other programming languages but am very unfamiliar with Java. I am looking for critiques of the coding style much ...
Stef's user avatar
  • 322
2 votes
2 answers
84 views

Given a sorted list of integers, find the highest count of elements between an indeterminate but fixed size range

I'm trying to optimize a function that takes a sorted list of integers and tells me what is the maximum number of elements in the list between any definite size range. To be clear, the range itself ...
Tyler Schuster's user avatar
4 votes
1 answer
99 views

Generate varied values of some parameters over a neighboring interval

I was recently tasked with creating a function that could generate a "varied" version of some collection of parameters. As in, it should take in a list of parameters, and then vary the value ...
horriblehaskell's user avatar
4 votes
6 answers
696 views

Finding missing numbers in ranges

I have a list of (potentially overlapping) ranges, e.g [(3, 9), (8, 10), (1, 18), (1, 1000000)]. I need to process them in order and for each range calculate how ...
Eugene Yarmash's user avatar
6 votes
3 answers
2k views

Count the numbers in a range in which the sum of the odds digits have the same parity of the evens one

As already written in the title I want to count the numbers in the range (x+1, y) where x and y are integers, in which the sum of the digits in odd places have the same parity of the ones in even ...
DarkSkull's user avatar
  • 163
2 votes
1 answer
64 views

Find coherent datetime ranges in postgresql

My Data consists of rows containing a Length/Duration in Minutes, a Begin & EndTime. The precision is 1min (or larger). the table looks something like that: ...
Fritz's user avatar
  • 121
-1 votes
1 answer
362 views

Hackerrank Gridland Metro - using Interval Cover Solution [closed]

Hi there I was hoping to get a better grasp of greddy algorithms while trying to solve this problem: Hackerrank: Gridland Metro and I was trying to apply an algorithm where each grid could be ...
Elliott de Launay's user avatar
2 votes
1 answer
629 views

Implement a range behaviour in Python using iterators

I've been assigned the following Python homework: Implement myrange that acts like range using iterators. Define a function ...
bobinthebox's user avatar
3 votes
1 answer
53 views

Calculating difference between cached period and requested

There is a remote resource containing datasets arranged by time, data is static and doesnt change. Whenever we are going to fetch anything from there we will be saving it in our cache. User might ...
RB_'s user avatar
  • 133
4 votes
2 answers
113 views

C++ PixelComponent struct

Hey I wrote a struct in C++ trying to represent a Pixel Component of a color Here it is ...
Hrant Nurijanyan's user avatar
1 vote
1 answer
2k views

The most minimal way to retrieve live data using setInterval

I am writing a script that is supposed to retrieve some data from a MYSQL database but I need to make it happen live and after lots of research I learned that this thing can be done using something ...
Nyx's user avatar
  • 113
3 votes
1 answer
159 views

template iterable numeric range class with multiple min/max inclusion modes

Problem my code solves: Lack of lightweight numeric range classes which can tell if arbitrary values lie inside them, supporting more than just simple exclusive max modes and integers, and that ...
Krupip's user avatar
  • 926
6 votes
1 answer
107 views

Using python to estimate the range of unstructured data

I have unstructured input-output data, f=f(x). I want to estimate the range of f as a function of x, given limited sampled. So, I tried to discretize the data use small bins in x to estimate the ...
kilojoules's user avatar
4 votes
2 answers
211 views

Simple timestamping filter in C

I wrote a simple timestamping filter that prepends each line with the UNIX timestamp in nanosecond precision as returned by clock_gettime, as well as the difference to the previous timestamp. ...
Thure Dührsen's user avatar

15 30 50 per page
1
2 3 4 5
11