Views : 16
# Given say {"a": 3, "b": 10, "c": 7, "d": 19} and [1,5,15] return {0: ["a"], 1: ["b", "c"], 2: ["d"]}
for i, date in enumerate(message_dates):
last_index = i + 1 == len(message_dates)
next_index = -1 if last_index else i + 1
else:
break

find_read_to({"a": 3, "b": 10, "c": 7, "d": 19}, [1,5,15])

{0: ['a'], 1: ['c', 'b'], 2: ['d']}
import bisect
return None
user_id = user_ids[i]
else:

find_read_to({"a": 3, "b": 10, "c": 7, "d": 19}, [1,5,15])

{0: ['a'], 1: ['c', 'b'], 2: ['d']}
%coffee
underscore = require('underscore')
Array::bisect = (val) ->
idx = undefined
if @length == 0
return 0
idx = 0
while idx < @length
if val < @[idx]
return idx
idx++
idx

return null
user_id = user_ids[i]
continue
else

console.log(find_read_tos({"a": 3, "b": 10, "c": 7, "d": 19}, [1,5,15]))

{ '0': [ 'a' ], '1': [ 'b', 'c' ], '2': [ 'd' ] }
%coffee
array_bisect = (arr, val) ->
idx = undefined
if arr.length == 0
return 0
idx = 0
while idx < arr.length
if val < arr[idx]
return idx
idx++
idx
console.log(array_bisect([0,3,5,15,30,90], 11))

3


coffee??

   File: /projects/d8eac431-3b55-40d3-89ee-fcada259f1ad
Unable to read source code (source code not available)

%coffee
find_smaller_number = (arr, val) ->
idx = undefined
if arr.length == 0
return -1
idx = 0
while idx < arr.length
if val < arr[idx]
return idx - 1
idx++
idx - 1
console.log(find_smaller_number([], 9))

-1
%coffee
_ = require('underscore')
console.log(_.sortBy([5,3,9,1]))

[ 1, 3, 5, 9 ]