You are viewing a single comment's thread. Return to all comments →
Typescript
function icecreamParlor(m: number, arr: number[]): number[] { let obj = {} as any; for (let i = 0; i < arr.length; i++) { obj[arr[i]] = i; } for (let j = 0; j < arr.length; j++) { const target = m - arr[j]; if (obj[target] && obj[target] !== j) { return [j + 1, obj[target] + 1]; } } return []; }
Seems like cookies are disabled on this browser, please enable them to open this website
Ice Cream Parlor
You are viewing a single comment's thread. Return to all comments →
Typescript