Questions tagged [find-occurrences]

435 questions
-1
votes
1 answer

Get lowest frequency in array JS

I am making a random letters generator. It has to find a given word in the least amount of tries. It lists the number of tries everytime in an array. I want to get the least frequent value in the array. I already got the most frequent value to work…
ttb
  • 75
  • 2
  • 7
-1
votes
2 answers

aggregating factors of different length dataframes

I have various dataframes like: Var1 "Bananas" "Apples" "Oranges" Freq "2" "2" "1" Var2 "Bananas" "Carrots" "Strawberries" "Apples" Freq "3" "2" "3" "4" and as output I'd like…
heffalump
  • 23
  • 4
-1
votes
1 answer

python - find position of next item in list, given criteria

I'm very new to Python, so dumbed-down explanations will be greatly appreciated. I have data that I have read in from a csv file that I have manipulated to be in the form: [(t1,n1,v1),(t2,n2,v2),(t3,n3,v3),...] What I'm trying to do is, given a…
-1
votes
1 answer

Finding all occurrences of a substring in a string

I'm trying to find all the lines that include the package name in the stacktrace that I am given. Here's what I have: Log.d("result", result); ArrayList allOccurences = new ArrayList(); int lastIndex = 0; int…
Nelson.b.austin
  • 3,080
  • 6
  • 37
  • 63
-1
votes
1 answer

How to count the no of occurrences of a word in a text file in Ruby

I would like to know how it would be possible to 1) Get a txt file as an input. 2) count the no of times a word or words occur! eg say i want to count the no of times good , bad are found in a text file and print it! how would i do this using RUBY?
-1
votes
2 answers

Counting the occurrences of a value in a column of a matrix

I am currently trying to count the number of times that a value occurs in each column of a 10 x 10 matrix with Java. I can make it count the times in each row, but I am having a rough time with the column counts. Thanks for your help, I am new to…
-1
votes
7 answers

Counting Int Occurrences in an Array

I am trying to count the occurrences of integers in an array. I was able to get it to work by piecing together some code I found online but I don't really understand why its working. What I have is: int[] hand = {2, 4, 3, 2, 4}; int[] numOccurence =…
user2771729
  • 448
  • 1
  • 7
  • 13
-2
votes
1 answer

Solution for C# occurence but not using LINQ

For a given string in C# count the number of occurrences of each >character that repeats itself (occurs more than once). Example: string str = "abcdzefazz"; Expected output: Character a has 2 occurrences. Character z has 3 occurrences.
Boris
  • 11
  • 2
-2
votes
2 answers

Occurrence of number in array,with complexity log n algorithm and c

hi genius i wish you good day Situation: T [M] an array sorts in ascending order. Write an algorithm that calculates the number of occurrences of an integer x in the array T[M]. the number of comparison of x to the elements of T, must be of order…
user14997954
-2
votes
2 answers

Find repeated elements occuring more than Once

I have an array A as follows: A = [7 7 10 10 10 15 1 1 15 15 7 16 17 1 18]. '; How can I obtain all numbers which occur more than one times in my array? In this example the answer should be 1 7 10 15.
Adupa Vasista
  • 71
  • 1
  • 12
-2
votes
1 answer

SQL Server find each occurrence in table when it passes certain value

I have some data in table.
id date  value
1 1/1/2018 12:15      90
2 1/1/2018…
user1094183
  • 181
  • 1
  • 3
  • 12
-2
votes
1 answer

A is an arrays: determine if there are two integers that are present in A the same number of times

For example: A=[1,2,2,3,4,4,5]->true; A=[1,2,2,3,3,3,4,4,4,4]->false. proc(A){ list = newList() for (i=1 to length[A]) { occ = 0 n = a[i] for (j = 1 to length[A]) { if(a[j] == n) occ++ } list.append(occ) } but…
-2
votes
2 answers

Python: Print each match just one time with if statement

Am trying to check the existence of a list of strings in other list, it might exist more that one time, so when I print the result am getting more then 1 occurance in the result and I want it to print each occurance one time: This is what I have…
Ran
  • 635
  • 2
  • 10
  • 22
-2
votes
2 answers

How can I make a new array, by counting the no.of appearances of value and printing it next to that value?

I should make new array out of existing one (ex. 1 0 4 5 4 3 1) so that the new one contains digits already in existing array and the number of their appearances. So, the new one would look like this: 1 2 0 1 4 2 5 1 3 1 (1 appears 2 times, 0…
Tanya
  • 9
  • 1
-2
votes
1 answer

Using fromkeys to create a dictionary

I am writing in Python I have a list of tuples called 'positions'. Some of these tuples have more than 1 occurence in 'positions'. I want to create a dictionary named d with the code: d["positions"] = dict.fromkeys(positions) This gives me a…
Alexander Ameye
  • 175
  • 1
  • 1
  • 8
1 2 3
28
29