Difference between revisions of "LeetCode Solutions/Problem Group 2 (Flight Bookings)"
Jump to navigation
Jump to search
(Created page with "== LeetCode Problem 2 – Flight Bookings == === ZCUBES with KEYTAGS === <pre> bookings = [[1,2,10],[2,3,20],[2,5,25]], n = 5; ro={}; f=(x,y)=>ro[x]=(ro[x]||0) + y; f#; book...") |
|||
| Line 1: | Line 1: | ||
| − | == LeetCode | + | == LeetCode 1109. Corporate Flight Bookings == |
=== ZCUBES with KEYTAGS === | === ZCUBES with KEYTAGS === | ||
Revision as of 17:37, 3 June 2025
LeetCode 1109. Corporate Flight Bookings
ZCUBES with KEYTAGS
bookings = [[1,2,10],[2,3,20],[2,5,25]],
n = 5;
ro={};
f=(x,y)=>ro[x]=(ro[x]||0) + y;
f#;
bookings.map(r=>f((r[0])..(r[1]),r[2]));
ro
KEYTAGS(ro).map(r=>[r[0],SUM(r[1])])
PRINT(ro)
ZCUBES using Object.entries
bookings = [[1,2,10],[2,3,20],[2,5,25]],
n = 5;
ro={};
f=(x,y)=>ro[x]=(ro[x]||0) + y;
f#;
bookings.map(r=>f((r[0])..(r[1]),r[2]));
ro
Object.entries(ro).map(r=>[r[0],SUM(r[1])]);
PRINT(ro)