- Aggregated Pivot Table
- Bit Shifting
- Bitwise XOR
- Calculate Tick Size
- Collapsing Dictionaries
- Graphs - Breadth First Search
- Graphs - Depth First Search
- Graphs - Detecting Cycles
- Greatest Common Divisor
- Identity Matrix
- Least Common Multiple
- Log Parser
- Nanosleep
- One Hot Encoding
- Parent Child ID Mapping
- Slippage
- Split Training and Testing Sets
- Stratified Sampling
- Symbol Column Update
- Table Indexing
- Word Count
GMT Offset
Question: Define a function 'gmtoff' that takes in two timestamps (-12h) as arguments and returns the GMT offset of 'y' in relation to 'x'.
Example
q)gmtoff[.z.p;.z.P]
-4f
q)gmtoff[23:00+.z.d;00:00+.z.d+1]
1f
Solution
######## solution.q ########
gmtoff:{%[y-x;60*60*1e9]}
Explanation: Subtract 'x' from 'y' and divide by the number of nanoseconds in an hour