1,922 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
Best practices
0
votes
5
replies
133
views
Is there a better way to get the length of runs in a list in haskell?
module Trial where
import Data.List
getRunCount :: (Ord a, Eq a) => [a] -> [(a, Integer)]
getRunCount lst = getRunCount' (sort lst) []
where getRunCount' :: Eq a => [a] -> [(a, ...
1
vote
3
answers
124
views
Counting number of rows up to a specified value by type and id
I have a dataset with id, test_date, test_type, test_result - like this:
ID
Test_Date
Test_Type
Test_Result
1
2024年03月21日
A
Fail
1
2024年04月21日
A
Fail
1
2024年04月30日
A
Pass
1
2025年05月15日
B
Fail
1
2025年05月31日
...
2
votes
2
answers
86
views
How to count number of appearances in 3D cell
I have a cell 3x26x72 which contains a series of characters of size 1xN char. I would like to count the number of appearances of each serie of characters in the cell 1x26x72. I tried with "mode&...
3
votes
2
answers
208
views
How can I count lines of code in an R package?
How can I count the lines of code in an R package? I have two possible types of input:
The raw package code (my own package); I could point the function to the R folder that contains source code.
The ...
0
votes
6
answers
243
views
Trying to shift in a while loop
I need to create a program that can do this:
Input:
args2 one two three
Output:
You have entered 3 arguments:
#1: one
#2: two
#3: three
This is what I have so far:
#!/bin/bash
echo "You have ...
4
votes
1
answer
155
views
Algorithm to find the number of specific continuous substrings
I am trying to solve the following algorithmic problem:
Every day, Bob goes to work and does one of 26 possible tasks. The tasks are coded with the letters of the English alphabet from a to z. ...
2
votes
1
answer
185
views
What is the fastest way to compute number of 1 bits in an array of bytes?
I might be silly to ask this, but I search around in google and did not got an definite answer(maybe I should be more careful).
Given a series of bytes, what is the fastest way to know the number of 1 ...
0
votes
1
answer
44
views
Laravel withCount elements in related and subrealted table
I'm building application with Laravel, Inertiajs and Vue3.
There are three key tables in application: Operators, Locations and Terminals. Terminals belongs to Locations and Locations belongs to ...
0
votes
3
answers
118
views
google sheets formula to count years and year ranges presented different ways
I'm looking for an array formula that can count the number of years in each cell from a single column. Here's a link to a shared google sheet showing the input data in column E and the desired output ...
1
vote
1
answer
139
views
Where does my code fail? Longest sequence of alternating 0's and 1's
In an online exam for a programming job, I was asked to code, in python, a function that would receive an input list containing a sequence of 0's and 1's. The list always has at least one element, and ...
1
vote
3
answers
54
views
Count occurences (rows) between dates (SPSS)
I have data on surgeries, every row represent a patient with a performed surgery. I wish to answer the question: How many procedures has this surgeon performed in the last year (at that time of the ...
0
votes
3
answers
58
views
Why isn't the space complexity of program adding values to a letter keyed hash map linear? [closed]
Imagine a program that takes a string of length p as an argument, and counts each letter by adding 1 for every occurrence using a hash map that only uses the 26 letters of the English alphabet as keys....
-2
votes
2
answers
95
views
In my project i have to create a program that reads a file and counts the number of occurrences of a specific word
So far it reads the file and counts each word in the file, but i want it to count just the word "Ball". I'm wondering how can I do that. Here's what's in the text file and the code:
...
1
vote
0
answers
40
views
Counting Issue in Tableau
I am working with a live data stream in Tableau and don't have any control over the data. I am encountering an issue where I am getting two different values that should be the same. The first count is ...
1
vote
3
answers
77
views
Correctly count elements in comma-separated strings, as well as with 'and' and "and/or" in R, excluding certain cases
I have a dataframe that has a column that contains multiple Spanish words. What I want is to count the total number of elements that each row contains. I have the following dataframe as an example:
...