Longest Streak

Question: A streak is the consecutive reoccurance of an event. For example, if you flip a coin twice and it appears head both times, then there is a streak of two heads. Define a function 'streak' that returns the length of the longest streak of a list, as an integer.

Example

                                
                                q)streak `h`t`h`t`h`h`h`t`t`h`t
3
q)streak ()
0
                                
                            

Solution

Tags:
functions iterators
Searchable Tags
algorithms api architecture csv data structures dictionaries disk feedhandler finance functions ingestion ipc iterators machine learning math multithreading optimizations realtime sql statistics streaming strings tables temporal websockets

Email sent!

Email not sent