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
                                
                            

Solution

Tags:
functions iterators
Searchable Tags
algorithms api csv dictionaries feedhandler finance functions ingestion ipc iterators math optimizations realtime sql streaming strings tables temporal websockets

Email sent!

Email not sent