Episode 116: Max Gap Count in C++23 #6
codereport
started this conversation in
Episode
Replies: 2 comments 3 replies
-
What was the recipe for the Cathay Pacific lounge noodle soup :)? |
Beta Was this translation helpful? Give feedback.
3 replies
-
Cool episode! I don't know any array languages, but the way you described the array language solution at 10:11+ made me think of how I'd solve it in SQL - basically count how many diffs equal the max diff. create table input (x);
insert into input values (5), (3), (1), (10), (20), (15);
with diffs(diff) as (
select x - lag(x, 1) over (order by x)
from input
)
select count(*)
from diffs
where diff = (select max(diff) from diffs);
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Episode Link: https://adspthepodcast.com/2023/02/10/Episode-116.html
Feel free to write comments or ask questions 🙂
Beta Was this translation helpful? Give feedback.
All reactions